Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make setting the NODE_NAME similar to what core does.
  • Loading branch information
slide authored and Alex Earl committed Feb 4, 2015
1 parent de93818 commit 6338990
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -4,6 +4,7 @@
import hudson.Util;
import hudson.matrix.MatrixRun;
import hudson.model.*;
import hudson.model.Hudson.MasterComputer;
import hudson.util.LogTaskListener;
import org.jenkinsci.lib.envinject.EnvInjectException;
import org.jenkinsci.lib.envinject.EnvInjectLogger;
Expand Down Expand Up @@ -40,9 +41,14 @@ public Map<String, String> getJenkinsSystemVariables(boolean forceOnMaster) thro
//test if there is at least one executor
if (computer != null) {
result = computer.getEnvironment().overrideAll(result);
if(computer instanceof MasterComputer) {
result.put("NODE_NAME", "master");
} else {
result.put("NODE_NAME", computer.getName());
}

Node n = computer.getNode();
if (n != null) {
result.put("NODE_NAME", computer.getName());
result.put("NODE_LABELS", Util.join(n.getAssignedLabels(), " "));
}
}
Expand Down

0 comments on commit 6338990

Please sign in to comment.