@@ -106,10 +106,7 @@ if (empty($deploy_branch) && empty($deploy_pr)) {
106106putenv ('VORTEX_SSH_PREFIX=DEPLOY_LAGOON ' );
107107!empty ($ ssh_fingerprint ) && putenv ('VORTEX_DEPLOY_LAGOON_SSH_FINGERPRINT= ' . $ ssh_fingerprint );
108108!empty ($ ssh_file ) && putenv ('VORTEX_DEPLOY_LAGOON_SSH_FILE= ' . $ ssh_file );
109- passthru (__DIR__ . '/setup-ssh ' , $ ssh_exit_code );
110- if ($ ssh_exit_code !== 0 ) {
111- quit ($ ssh_exit_code );
112- }
109+ passthru_or_fail (__DIR__ . '/setup-ssh ' );
113110
114111// Install Lagoon CLI if needed.
115112if (!command_path ('lagoon ' ) || !empty ($ lagooncli_force_install )) {
@@ -118,13 +115,7 @@ if (!command_path('lagoon') || !empty($lagooncli_force_install)) {
118115 $ platform = strtolower (php_uname ('s ' ));
119116 $ arch = str_replace (['x86_64 ' , 'aarch64 ' ], ['amd64 ' , 'arm64 ' ], php_uname ('m ' ));
120117
121- $ download_url = sprintf (
122- 'https://github.com/uselagoon/lagoon-cli/releases/download/%s/lagoon-cli-%s-%s-%s ' ,
123- $ lagooncli_version ,
124- $ lagooncli_version ,
125- $ platform ,
126- $ arch
127- );
118+ $ download_url = sprintf ('https://github.com/uselagoon/lagoon-cli/releases/download/%s/lagoon-cli-%s-%s-%s ' , $ lagooncli_version , $ lagooncli_version , $ platform , $ arch );
128119
129120 $ lagoon_binary_path = $ lagooncli_path . '/lagoon ' ;
130121
@@ -152,20 +143,7 @@ if (!command_path('lagoon') || !empty($lagooncli_force_install)) {
152143}
153144
154145task ('Configuring Lagoon instance. ' );
155- passthru (
156- sprintf (
157- '%s config add --force --lagoon %s --graphql %s --hostname %s --port %s ' ,
158- escapeshellarg ($ lagoon_bin ),
159- escapeshellarg ($ lagoon_instance ),
160- escapeshellarg ($ lagoon_instance_graphql ),
161- escapeshellarg ($ lagoon_instance_hostname ),
162- escapeshellarg ($ lagoon_instance_port )
163- ),
164- $ config_exit_code
165- );
166- if ($ config_exit_code !== 0 ) {
167- quit ($ config_exit_code );
168- }
146+ passthru_or_fail (sprintf ('%s config add --force --lagoon %s --graphql %s --hostname %s --port %s ' , escapeshellarg ($ lagoon_bin ), escapeshellarg ($ lagoon_instance ), escapeshellarg ($ lagoon_instance_graphql ), escapeshellarg ($ lagoon_instance_hostname ), escapeshellarg ($ lagoon_instance_port )));
169147
170148/**
171149 * Run Lagoon CLI command.
@@ -183,14 +161,7 @@ function lagoon_run_cli(string $subcommand, ?int &$subcommand_exit_code = NULL):
183161 // phpcs:ignore Drupal.NamingConventions.ValidGlobal.GlobalUnderScore
184162 global $ ssh_file , $ lagoon_instance , $ lagoon_project , $ lagoon_bin ;
185163
186- $ cmd = sprintf (
187- '%s --force --skip-update-check --ssh-key %s --lagoon %s --project %s %s 2>&1 ' ,
188- escapeshellarg ($ lagoon_bin ),
189- escapeshellarg ($ ssh_file ),
190- escapeshellarg ($ lagoon_instance ),
191- escapeshellarg ($ lagoon_project ),
192- $ subcommand
193- );
164+ $ cmd = sprintf ('%s --force --skip-update-check --ssh-key %s --lagoon %s --project %s %s 2>&1 ' , escapeshellarg ($ lagoon_bin ), escapeshellarg ($ ssh_file ), escapeshellarg ($ lagoon_instance ), escapeshellarg ($ lagoon_project ), $ subcommand );
194165
195166 $ subcommand_exit_code_provided = TRUE ;
196167 if (is_null ($ subcommand_exit_code )) {
@@ -288,15 +259,7 @@ else {
288259 }
289260
290261 task (sprintf ('Redeploying environment: project %s, PR: %s. ' , $ lagoon_project , $ deploy_pr ));
291- $ deploy_cmd = sprintf (
292- 'deploy pullrequest --number %s --base-branch-name %s --base-branch-ref %s --head-branch-name %s --head-branch-ref %s --title %s ' ,
293- escapeshellarg ($ deploy_pr ),
294- escapeshellarg ($ deploy_pr_base_branch ),
295- escapeshellarg ('origin/ ' . $ deploy_pr_base_branch ),
296- escapeshellarg ($ deploy_branch ),
297- escapeshellarg ($ deploy_pr_head ),
298- escapeshellarg ($ deploy_pr_full )
299- );
262+ $ deploy_cmd = sprintf ('deploy pullrequest --number %s --base-branch-name %s --base-branch-ref %s --head-branch-name %s --head-branch-ref %s --title %s ' , escapeshellarg ($ deploy_pr ), escapeshellarg ($ deploy_pr_base_branch ), escapeshellarg ('origin/ ' . $ deploy_pr_base_branch ), escapeshellarg ($ deploy_branch ), escapeshellarg ($ deploy_pr_head ), escapeshellarg ($ deploy_pr_full ));
300263 $ deploy_output = lagoon_run_cli ($ deploy_cmd );
301264 $ exit_code = lagoon_handle_environment_limit_exceeded ($ deploy_output );
302265
@@ -310,15 +273,7 @@ else {
310273 // Fresh deployment.
311274 else {
312275 task (sprintf ('Deploying environment: project %s, PR: %s. ' , $ lagoon_project , $ deploy_pr ));
313- $ deploy_cmd = sprintf (
314- 'deploy pullrequest --number %s --base-branch-name %s --base-branch-ref %s --head-branch-name %s --head-branch-ref %s --title %s ' ,
315- escapeshellarg ($ deploy_pr ),
316- escapeshellarg ($ deploy_pr_base_branch ),
317- escapeshellarg ('origin/ ' . $ deploy_pr_base_branch ),
318- escapeshellarg ($ deploy_branch ),
319- escapeshellarg ($ deploy_pr_head ),
320- escapeshellarg ($ deploy_pr_full )
321- );
276+ $ deploy_cmd = sprintf ('deploy pullrequest --number %s --base-branch-name %s --base-branch-ref %s --head-branch-name %s --head-branch-ref %s --title %s ' , escapeshellarg ($ deploy_pr ), escapeshellarg ($ deploy_pr_base_branch ), escapeshellarg ('origin/ ' . $ deploy_pr_base_branch ), escapeshellarg ($ deploy_branch ), escapeshellarg ($ deploy_pr_head ), escapeshellarg ($ deploy_pr_full ));
322277 $ deploy_output = lagoon_run_cli ($ deploy_cmd , $ exit_code );
323278 $ exit_code = lagoon_handle_environment_limit_exceeded ($ deploy_output );
324279 }
0 commit comments