-
Bug
-
Resolution: Fixed
-
Minor
-
None
The following Jenkinsfile fails
podTemplate(containers: [ containerTemplate(name: 'busybox', image: 'busybox', ttyEnabled: true, command: '/bin/cat', workingDir: '/src') ]) { node (POD_LABEL) { stage('Run') { sh 'env | sort' container('busybox') { sh 'env | sort' } } } }
Whereas this one works
podTemplate(containers: [ containerTemplate(name: 'jnlp', image: 'jenkinsci/jnlp-slave:latest'), containerTemplate(name: 'busybox', image: 'busybox', ttyEnabled: true, command: '/bin/cat', workingDir: '/src') ]) { node (POD_LABEL) { stage('Run') { sh 'env | sort' container('busybox') { sh 'env | sort' } } } }
The reason is
https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesSlave.java#L130
calls
https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/main/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplate.java#L276
which then uses the working dir of the first container defined in the pod, instead of using the jnlp container all the time.
- links to
[JENKINS-61178] When defining an extra container in a pod template with a custom working dir, it is wrongly used as the node working dir
Assignee | New: Vincent Latombe [ vlatombe ] |
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Remote Link | New: This issue links to "PR #717 (Web Link)" [ 24510 ] |
Status | Original: In Progress [ 3 ] | New: In Review [ 10005 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Review [ 10005 ] | New: Fixed but Unreleased [ 10203 ] |