public function deploy()

in src/TestUtils/GcloudWrapper/AppEngine.php [69:118]


    public function deploy($options = [])
    {
        // Handle old function signature
        if (!is_array($options)) {
            $options = array_filter([
                'targets' => @func_get_arg(0),
                'promote' => @func_get_arg(1),
            ]) + array_filter([
                'retries' => @func_get_arg(2),
            ], 'is_numeric');
        }
        $options = array_merge([
            'targets' => 'app.yaml',
            'promote' => false,
            'retries' => 3,
            'release_version' => null,
        ], $options);
        if (!in_array($options['release_version'], [null, 'alpha', 'beta'])) {
            $this->errorLog('release_version must be "alpha" or "beta"');

            return false;
        }
        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 -q %s%s deploy --project %s --version %s %s %s',
            $options['release_version'] ? $options['release_version'] . ' ' : '',
            self::GCLOUD_COMPONENT,
            $this->project,
            $this->version,
            $options['promote'] ? '--promote' : '--no-promote',
            $options['targets']
        );
        $ret = $this->execWithRetry($cmd, $options['retries']);
        chdir($orgDir);
        if ($ret) {
            $this->deployed = true;
        }

        return $ret;
    }