Skip to content

Commit 8367ac4

Browse files
committed
Revert "[FIXED JENKINS-37987] Override ENTRYPOINT, not just command, for WithContainerStep."
This reverts commit 5b0586d.
1 parent f342888 commit 8367ac4

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ public DockerClient(@Nonnull Launcher launcher, @CheckForNull Node node, @CheckF
9595
* @param volumesFromContainers Mounts all volumes from the given containers.
9696
* @param containerEnv Environment variables to set in container.
9797
* @param user The <strong>uid:gid</strong> to execute the container command as. Use {@link #whoAmI()}.
98-
* @param entrypoint The command to execute in the image container being run.
98+
* @param command The command to execute in the image container being run.
9999
* @return The container ID.
100100
*/
101-
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 {
101+
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 {
102102
ArgumentListBuilder argb = new ArgumentListBuilder();
103103

104104
argb.add("run", "-t", "-d", "-u", user);
@@ -119,7 +119,9 @@ public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNu
119119
argb.add("-e");
120120
argb.addMasked(variable.getKey()+"="+variable.getValue());
121121
}
122-
argb.add("--entrypoint").add(entrypoint).add(image);
122+
if (command != null) {
123+
argb.add(image).add(command);
124+
}
123125

124126
LaunchResult result = launch(launchEnv, false, null, argb);
125127
if (result.getStatus() == 0) {

src/test/java/org/jenkinsci/plugins/docker/workflow/DockerDSLTest.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import org.junit.Test;
6161
import org.junit.runners.model.Statement;
6262
import org.jvnet.hudson.test.BuildWatcher;
63-
import org.jvnet.hudson.test.Issue;
6463
import org.jvnet.hudson.test.RestartableJenkinsRule;
6564

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

149-
@Issue("JENKINS-37987")
150-
@Test public void entrypoint() {
151-
story.addStep(new Statement() {
152-
@Override public void evaluate() throws Throwable {
153-
assumeDocker();
154-
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
155-
p.setDefinition(new CpsFlowDefinition(
156-
"docker.image('maven:latest').inside {\n" +
157-
" sh 'mvn -version'\n" +
158-
"}", true));
159-
160-
story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
161-
}
162-
});
163-
}
164-
165148
@Test public void endpoints() {
166149
story.addStep(new Statement() {
167150
@Override public void evaluate() throws Throwable {

0 commit comments

Comments
 (0)