Skip to content

Commit

Permalink
Merge pull request #17 from Vlatombe/docker-with-node-environment
Browse files Browse the repository at this point in the history
[FIXED JENKINS-28611] Execute docker with the node environment
  • Loading branch information
Vlatombe committed Aug 3, 2015
2 parents 4a44d4d + d6accae commit ad7edee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -169,7 +169,6 @@ private static class Decorator extends LauncherDecorator implements Serializable
List<String> prefix = new ArrayList<String>(Arrays.asList("docker", "exec", container, "env"));
Set<String> envReduced = new TreeSet<String>(Arrays.asList(starter.envs()));
envReduced.removeAll(Arrays.asList(envHost));
starter.envs(new String[0]);
prefix.addAll(envReduced);
// Adapted from decorateByPrefix:
starter.cmds().addAll(0, prefix);
Expand Down
Expand Up @@ -84,13 +84,14 @@ public class WithContainerStepTest {
p.setDefinition(new CpsFlowDefinition(
"node {\n" +
" withDockerContainer('httpd:2.4.12') {\n" +
" sh 'echo sleeping now with JENKINS_SERVER_COOKIE=$JENKINS_SERVER_COOKIE; sleep 999'\n" +
" sh 'trap \\'echo got SIGTERM\\' TERM; trap \\'echo exiting; exit 99\\' EXIT; echo sleeping now with JENKINS_SERVER_COOKIE=$JENKINS_SERVER_COOKIE; sleep 999'\n" +
" }\n" +
"}", true));
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
JenkinsRuleExt.waitForMessage("sleeping now", b);
b.doStop();
story.j.assertBuildStatus(Result.ABORTED, JenkinsRuleExt.waitForCompletion(b));
story.j.assertLogContains("script returned exit code 99", b);
}
});
}
Expand Down

0 comments on commit ad7edee

Please sign in to comment.