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

Commit

Permalink
[JENKINS-28131] Solved a findbug issue
Browse files Browse the repository at this point in the history
  • Loading branch information
recena committed Jun 29, 2015
1 parent f9e64a4 commit 6a64190
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -40,6 +40,11 @@ public class EnvWorkflowTest {

@Rule public JenkinsRule r = new JenkinsRule();

/**
* Verifies if NODE_NAME environment variable is available in a slave node.
*
* @throws Exception
*/
@Test public void areAvailable() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "workflow-test");
DumbSlave s = r.createSlave("node-test", null, null);
Expand Down
Expand Up @@ -425,14 +425,16 @@ 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.getEnvironment();
env.overrideAll(computer.buildEnvironment(listener));
env.put(COOKIE_VAR, cookie);
if (getExecutor().getOwner() instanceof MasterComputer) {
if (exec.getOwner() instanceof MasterComputer) {
env.put("NODE_NAME", "master");
} else {
env.put("NODE_NAME", label);
}

synchronized (runningTasks) {
runningTasks.put(cookie, new RunningTask(context));
}
Expand Down

0 comments on commit 6a64190

Please sign in to comment.