Skip to content

Commit

Permalink
JENKINS-33063
Browse files Browse the repository at this point in the history
  • Loading branch information
vfarcic committed Mar 16, 2016
1 parent 8686313 commit 8ac9589
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Expand Up @@ -123,7 +123,7 @@ class Docker implements Serializable {

public Container run(String args = '', String command = "") {
docker.node {
docker.script.sh "docker run -d${args != '' ? ' ' + args : ''} ${id} ${command} > .container"
docker.script.sh "docker run -d${args != '' ? ' ' + args : ''} ${id}${command != '' ? ' ' + command : ''} > .container"
def container = docker.script.readFile('.container').trim()
docker.script.dockerFingerprintRun containerId: container, toolName: docker.script.env.DOCKER_TOOL_NAME
new Container(docker, container)
Expand Down
Expand Up @@ -324,4 +324,20 @@ private static void grep(File dir, String text, String prefix, Set<String> match
}
});
}

@Test public void run() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
assumeDocker();
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
p.setDefinition(new CpsFlowDefinition(
"node {\n" +
" def busybox = docker.image('busybox');\n" +
" busybox.run('--rm', 'echo \"Hello\"');\n" +
"}", true));
WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
story.j.assertLogContains("Hello", b);
}
});
}
}

0 comments on commit 8ac9589

Please sign in to comment.