Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifying that tools do not assume sh is in /bin/sh #490

Merged
merged 10 commits into from
Jul 6, 2019
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@
<version>6.8</version>
</dependency>

<dependency> <!-- OnceRetentionStrategy -->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>durable-task</artifactId>
<version>1.29</version>
<version>1.30-rc416.ace2b55005b1</version> <!-- TODO https://github.com/jenkinsci/durable-task-plugin/pull/95 -->
jglick marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class ContainerExecDecorator extends LauncherDecorator implements Seriali
private static final String COOKIE_VAR = "JENKINS_SERVER_COOKIE";

private static final Logger LOGGER = Logger.getLogger(ContainerExecDecorator.class.getName());
private static final String DEFAULT_SHELL="/bin/sh";
private static final String DEFAULT_SHELL = "sh";

/**
* stdin buffer size for commands sent to Kubernetes exec api. A low value will cause slowness in commands executed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ public void runInPodWithDifferentShell() throws Exception {
*/
}

@Test
public void bourneShellElsewhereInPath() throws Exception {
r.assertBuildStatusSuccess(r.waitForCompletion(b));
r.assertLogContains("/kaniko:/busybox", b);
}

@Test
public void runInPodWithMultipleContainers() throws Exception {
r.assertBuildStatusSuccess(r.waitForCompletion(b));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
podTemplate(label: '$NAME', containers: [containerTemplate(name: 'kaniko', image: 'gcr.io/kaniko-project/executor:debug', command: 'sleep', args: '99d')]) {
node('$NAME') {
container(name: 'kaniko') {
Copy link
Member Author

@jglick jglick Jun 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the ContainerExecDecorator patch, this fails unless you

-container(name: 'kaniko') {
+container(name: 'kaniko', shell: '/busybox/sh') {

sh 'echo $PATH'
}
}
}