WorkingDir must match on every containerTemplate

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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"'
         }
       }
      }
      

       

            Assignee:
            Unassigned
            Reporter:
            Pascal Laporte
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: