Skip to content
Permalink
Browse files
JENKINS-33063
  • Loading branch information
vfarcic committed Mar 16, 2016
1 parent 8686313 commit 8ac95891861bd5405265f9b410b2e6d02fcbeaac
@@ -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)
@@ -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.