@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Put back the stronger variable replacement

Summary: This puts back the stronger variable replacement that was missed the last update to D7519.

Test Plan: Re-ran a remote build that had variables in the command and everything worked as expected.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T1049

Differential Revision: https://secure.phabricator.com/D7539

authored by

James Rhodes and committed by
epriestley
197e9b6f 8f52778f

+20 -2
+20 -2
src/applications/harbormaster/step/RemoteCommandBuildStepImplementation.php
··· 26 26 27 27 $settings = $this->getSettings(); 28 28 29 + $parameters = array(); 30 + $matches = array(); 31 + $variables = $this->retrieveVariablesFromBuild($build); 32 + $command = $settings['command']; 33 + preg_match_all( 34 + "/\\\$\\{(?P<name>[a-z]+)\\}/", 35 + $command, 36 + $matches); 37 + foreach ($matches["name"] as $match) { 38 + $parameters[] = idx($variables, $match, ""); 39 + } 40 + $command = str_replace("%", "%%", $command); 41 + $command = preg_replace("/\\\$\\{(?P<name>[a-z]+)\\}/", "%s", $command); 42 + 43 + $command = vcsprintf( 44 + $command, 45 + $parameters); 46 + 29 47 $future = null; 30 48 if (empty($settings['sshkey'])) { 31 49 $future = new ExecFuture( 32 50 'ssh -o "StrictHostKeyChecking no" -p %s %s %s', 33 51 $settings['sshport'], 34 52 $settings['sshuser'].'@'.$settings['sshhost'], 35 - $this->mergeVariables($build, $settings['command'])); 53 + $command); 36 54 } else { 37 55 $future = new ExecFuture( 38 56 'ssh -o "StrictHostKeyChecking no" -p %s -i %s %s %s', 39 57 $settings['sshport'], 40 58 $settings['sshkey'], 41 59 $settings['sshuser'].'@'.$settings['sshhost'], 42 - $this->mergeVariables($build, $settings['command'])); 60 + $command); 43 61 } 44 62 45 63 $log_stdout = $build->createLog($build_step, "remote", "stdout");