public function run()
    {
        $template = $this->twig->load('cloudbuild.yaml.tmpl');
        $context = [
            'cloud_sql_instances' => $this->cloudSqlInstances,
            'cloud_sql_proxy_image' => self::CLOUD_SQL_PROXY_IMAGE,
            'target_image' => $this->image,
            'commands' => implode(
                ',',
                array_map('escapeshellarg', $this->commands)
            )
        ];
        $cloudBuildYaml = $template->render($context);
        file_put_contents("$this->workdir/cloudbuild.yaml", $cloudBuildYaml);
        list($result, $cmdOutput) = $this->gcloud->exec(
            [
                'container',
                'builds',
                'submit',
                "--config=$this->workdir/cloudbuild.yaml",
                "$this->workdir"
            ]
        );
        file_put_contents(
            "$this->workdir/cloudbuild.log",
            implode(PHP_EOL, $cmdOutput)
        );
        if ($result !== 0) {
            throw new \RuntimeException("Failed to run the command");
        }
        $ret = '';
        if ($this->cloudSqlInstances) {
            $targetStep = 'Step #3';
        } else {
            $targetStep = 'Step #1';
        }
        foreach ($cmdOutput as $line) {
            if (\strpos($line, $targetStep) !== false) {
                $ret .= $line . PHP_EOL;
            }
        }
        return $ret;
    }