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

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

    XMLWordPrintable

Details

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

    Description

       

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

       

       

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: