in src/TestUtils/GcloudWrapper/CloudRun.php [109:142]
public function deploy($image, array $options = [])
{
// Set default optioins
$options = array_merge([
'retries' => 3,
], $options);
if ($this->deployed) {
$this->errorLog('The app has been already deployed.');
return false;
}
$orgDir = getcwd();
if (chdir($this->dir) === false) {
$this->errorLog('Can not chdir to ' . $this->dir);
return false;
}
$cmd = sprintf(
'gcloud beta %s deploy %s --image %s%s --platform %s --project %s',
self::GCLOUD_COMPONENT,
$this->service,
$image,
$this->region ? sprintf(' --region %s', $this->region) : '',
$this->platform,
$this->project
);
$ret = $this->execWithRetry($cmd, $options['retries']);
chdir($orgDir);
if ($ret) {
$this->deployed = true;
}
return $ret;
}