Skip to content

Commit

Permalink
Revert "[FIXED JENKINS-37987] Override ENTRYPOINT, not just command, …
Browse files Browse the repository at this point in the history
…for WithContainerStep."

This reverts commit 5b0586d.
  • Loading branch information
ndeloof committed Jan 25, 2018
1 parent f342888 commit 8367ac4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
Expand Up @@ -95,10 +95,10 @@ public DockerClient(@Nonnull Launcher launcher, @CheckForNull Node node, @CheckF
* @param volumesFromContainers Mounts all volumes from the given containers.
* @param containerEnv Environment variables to set in container.
* @param user The <strong>uid:gid</strong> to execute the container command as. Use {@link #whoAmI()}.
* @param entrypoint The command to execute in the image container being run.
* @param command The command to execute in the image container being run.
* @return The container ID.
*/
public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNull String args, @CheckForNull String workdir, @Nonnull Map<String, String> volumes, @Nonnull Collection<String> volumesFromContainers, @Nonnull EnvVars containerEnv, @Nonnull String user, @Nonnull String entrypoint) throws IOException, InterruptedException {
public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNull String args, @CheckForNull String workdir, @Nonnull Map<String, String> volumes, @Nonnull Collection<String> volumesFromContainers, @Nonnull EnvVars containerEnv, @Nonnull String user, @CheckForNull String... command) throws IOException, InterruptedException {
ArgumentListBuilder argb = new ArgumentListBuilder();

argb.add("run", "-t", "-d", "-u", user);
Expand All @@ -119,7 +119,9 @@ public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNu
argb.add("-e");
argb.addMasked(variable.getKey()+"="+variable.getValue());
}
argb.add("--entrypoint").add(entrypoint).add(image);
if (command != null) {
argb.add(image).add(command);
}

LaunchResult result = launch(launchEnv, false, null, argb);
if (result.getStatus() == 0) {
Expand Down
Expand Up @@ -60,7 +60,6 @@
import org.junit.Test;
import org.junit.runners.model.Statement;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.RestartableJenkinsRule;

public class DockerDSLTest {
Expand Down Expand Up @@ -146,22 +145,6 @@ private static void grep(File dir, String text, String prefix, Set<String> match
});
}

@Issue("JENKINS-37987")
@Test public void entrypoint() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
assumeDocker();
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition(
"docker.image('maven:latest').inside {\n" +
" sh 'mvn -version'\n" +
"}", true));

story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
}
});
}

@Test public void endpoints() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
Expand Down

0 comments on commit 8367ac4

Please sign in to comment.