Skip to content

Commit

Permalink
Merge pull request #14 from nekromant/master
Browse files Browse the repository at this point in the history
Properly expand build environment variables, hopefully fix JENKINS-20478
  • Loading branch information
mambu authored Jul 28, 2017
2 parents 9da2ce4 + 99b2044 commit 183860a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/hudson/plugins/xshell/XShellBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,16 @@ public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher,
LOG.log(Level.FINE, "Regex to kill: " + regexToKill);
LOG.log(Level.FINE, "Time allocated before kill: " + timeAllocated);

final EnvVars env = build.getEnvironment(listener);


String cmdLine = convertSeparator(commandLine, (launcher.isUnix() ? UNIX_SEP : WINDOWS_SEP));
LOG.log(Level.FINE, "File separators sanitized: " + cmdLine);


cmdLine = env.expand(cmdLine);

LOG.log(Level.FINE, "Expanded build environment vars: " + cmdLine);

if (launcher.isUnix()) {
cmdLine = convertEnvVarsToUnix(cmdLine);
} else {
Expand All @@ -112,7 +119,6 @@ public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher,
LOG.log(Level.FINE, "Windows command: " + args.toStringWithQuote());
}

EnvVars env = build.getEnvironment(listener);
env.putAll(build.getBuildVariables());

LOG.log(Level.FINEST, "Environment variables: " + env.entrySet().toString());
Expand Down

0 comments on commit 183860a

Please sign in to comment.