-
Bug
-
Resolution: Duplicate
-
Minor
-
None
When setting different workingDir on each container Template.
The «durable» script fail. It is referring to the first workingDir instead of the one for is container.
A simple example that fail.
podTemplate(label: 'mypod', containers: [ containerTemplate(name: 'golang', image: 'golang:1.6.3', ttyEnabled: true, command: 'cat', workingDir:'/someworkingdir') ]) { node('mypod') { container('golang'){ sh 'echo "POPO"' } } }
Will fail, since the default workingDir of the jnlp slave ('/home/jenkins') doesn't match with «/someworkingdir» on the golang containerTemplate.
This same example, where the jnlp and golang workingDir match the same value, would work:
podTemplate(label: 'mypod', containers: [ containerTemplate(name: 'jnlp', image: 'jenkinsci/jnlp-slave:2.62-alpine', args: '${computer.jnlpmac} ${computer.name}', workingDir:'/someworkingdir'), containerTemplate(name: 'golang', image: 'golang:1.6.3', ttyEnabled: true, command: 'cat', workingDir:'/someworkingdir') ]) { node('mypod') { container('golang'){ sh 'echo "POPO"' } } }
- duplicates
-
JENKINS-58975 Executing shell in a container with a custom workingDir times out
- Resolved