Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-44030

WorkingDir must match on every containerTemplate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • kubernetes-plugin
    • 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"'
         }
       }
      }
      

       

            Unassigned Unassigned
            pascallap Pascal Laporte
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: