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

Dir Step doesn't work inside container step when dir is outside the workspace

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • kubernetes-plugin
    • None

       

      When i use a dir step inside the container step i get allways a

      error:
      ERROR: script returned exit code -2
      Finished: FAILURE
      jenkinsfile

      #!/usr/bin/env groovy
      
       node {
         deleteDir()
         checkout scm
      
         def uniqueId = UUID.randomUUID().toString()
       
         stage('testing') {
           podTemplate(
             name: env.jaas_owner + '-jaas',
             label: uniqueId,
             containers: [
               containerTemplate(
                 name: 'busybox',
                 image: 'busybox',
                 command: 'cat'
               )
             ]
           )
             {
               node(uniqueId) {
                 container('busybox') {
                   sh '''
                   cd /var
                   ls -al
                   '''
      
                   dir ('/var'){
                     sh '''
                     cd /var
                     ls -al
                     '''
                   }
                 }
               }
           }
         }
       }

       

       

          [JENKINS-47305] Dir Step doesn't work inside container step when dir is outside the workspace

          Gordon Franke created issue -
          Carlos Sanchez made changes -
          Summary Original: Dir Step doesn't work inside container step New: Dir Step doesn't work inside container step when dir is outside the workspace
          Imran Noor Mohamed made changes -
          Description Original:  

          When i use a dir step inside the container step i get allways a

          error:
          ERROR: script returned exit code -2
          Finished: FAILURE
          jenkinsfile
          {code:java}
          #!/usr/bin/env groovy

           node {
             deleteDir()
             checkout scm

             def uniqueId = UUID.randomUUID().toString()
           
             stage('testing') {
               podTemplate(
                 name: env.jaas_owner + '-jaas',
                 label: uniqueId,
                 containers: [
                   containerTemplate(
                     name: 'busybox',
                     image: 'busybox',
                     command: 'cat'
                   )
                 ]
               )
                 {
                   node(uniqueId) {
                     container('busybox') {
                       sh '''
                       cd /var
                       ls -al
                       '''

                       dir ('/var'){
                         sh '''
                         cd /var
                         ls -al
                         '''
                       }
                     }
                   }
               }
             }
           }{code}
           

           
          New:  

          When i use a dir step inside the container step i get allways a

          error:
          ERROR: script returned exit code -2
          Finished: FAILURE
          jenkinsfile
          {code:java}
          #!/usr/bin/env groovy

           node {
             deleteDir()
             checkout scm

             def uniqueId = UUID.randomUUID().toString()
           
             stage('testing') {
               podTemplate(
                 name: env.jaas_owner + '-jaas',
                 label: uniqueId,
                 containers: [
                   containerTemplate(
                     name: 'busybox',
                     image: 'busybox',
                     command: 'cat'
                   )
                 ]
               )
                 {
                   node(uniqueId) {
                     container('busybox') {
                       sh '''
                       cd /var
                       ls -al
                       '''

                       dir ('/var'){
                         sh '''
                         cd /var
                         ls -al
                         '''
                       }
                     }
                   }
               }
             }
           }{code}
           

           
          Jesse Glick made changes -
          Assignee Original: Carlos Sanchez [ csanchez ]
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-33510 [ JENKINS-33510 ]
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-46055 [ JENKINS-46055 ]
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            Unassigned Unassigned
            gimler Gordon Franke
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: