Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
[FIXED JENKINS-26552] Provide a full Computer.environment to @StepCon…
Browse files Browse the repository at this point in the history
…textParameter EnvVars.
  • Loading branch information
jglick committed Jan 22, 2015
1 parent 5a9ae5b commit b490007
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Expand Up @@ -26,7 +26,6 @@

import groovy.lang.GroovyObjectSupport;
import hudson.EnvVars;
import hudson.model.Computer;
import hudson.model.Run;
import hudson.util.LogTaskListener;
import java.io.IOException;
Expand Down Expand Up @@ -72,14 +71,14 @@ public Map<String,String> getOverriddenEnvironment() {

@Override public Object getProperty(String propertyName) {
try {
String val = getEnvironment().get(propertyName);
if (val == null) {
Computer computer = CpsThread.current().getContextVariable(Computer.class);
if (computer != null) {
return computer.getEnvironment().get(propertyName);
EnvVars overridden = CpsThread.current().getContextVariable(EnvVars.class);
if (overridden != null) {
String val = overridden.get(propertyName);
if (val != null) {
return val;
}
}
return val;
return getEnvironment().get(propertyName);
} catch (Exception x) {
LOGGER.log(Level.WARNING, null, x);
return null;
Expand Down
Expand Up @@ -387,7 +387,8 @@ private final class PlaceholderExecutable implements ContinuableExecutable {
cookie = UUID.randomUUID().toString();
// Switches the label to a self-label, so if the executable is killed and restarted via ExecutorPickle, it will run on the same node:
label = computer.getName();
EnvVars env = computer.buildEnvironment(listener);
EnvVars env = computer.getEnvironment();
env.overrideAll(computer.buildEnvironment(listener));
env.put(COOKIE_VAR, cookie);
synchronized (runningTasks) {
runningTasks.put(cookie, context);
Expand Down

0 comments on commit b490007

Please sign in to comment.