mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-01 01:18:22 +01:00
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
This commit is contained in:
parent
8f52778f32
commit
197e9b6f49
1 changed files with 20 additions and 2 deletions
|
@ -26,20 +26,38 @@ final class RemoteCommandBuildStepImplementation
|
|||
|
||||
$settings = $this->getSettings();
|
||||
|
||||
$parameters = array();
|
||||
$matches = array();
|
||||
$variables = $this->retrieveVariablesFromBuild($build);
|
||||
$command = $settings['command'];
|
||||
preg_match_all(
|
||||
"/\\\$\\{(?P<name>[a-z]+)\\}/",
|
||||
$command,
|
||||
$matches);
|
||||
foreach ($matches["name"] as $match) {
|
||||
$parameters[] = idx($variables, $match, "");
|
||||
}
|
||||
$command = str_replace("%", "%%", $command);
|
||||
$command = preg_replace("/\\\$\\{(?P<name>[a-z]+)\\}/", "%s", $command);
|
||||
|
||||
$command = vcsprintf(
|
||||
$command,
|
||||
$parameters);
|
||||
|
||||
$future = null;
|
||||
if (empty($settings['sshkey'])) {
|
||||
$future = new ExecFuture(
|
||||
'ssh -o "StrictHostKeyChecking no" -p %s %s %s',
|
||||
$settings['sshport'],
|
||||
$settings['sshuser'].'@'.$settings['sshhost'],
|
||||
$this->mergeVariables($build, $settings['command']));
|
||||
$command);
|
||||
} else {
|
||||
$future = new ExecFuture(
|
||||
'ssh -o "StrictHostKeyChecking no" -p %s -i %s %s %s',
|
||||
$settings['sshport'],
|
||||
$settings['sshkey'],
|
||||
$settings['sshuser'].'@'.$settings['sshhost'],
|
||||
$this->mergeVariables($build, $settings['command']));
|
||||
$command);
|
||||
}
|
||||
|
||||
$log_stdout = $build->createLog($build_step, "remote", "stdout");
|
||||
|
|
Loading…
Add table
Reference in a new issue