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

Jenkins does not allocate workspace for neither declarative pipeline nor scripted pipeline jobs

    • Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Minor Minor

      Pipeline jobs do not allocate workspace automatically

      Steps to reproduce for scripted pipeline

      1. Create pipeline job
      2. Put the following script into "Pipeline Script" field
      node {
         stage('Prepare') {
              echo "WS: ${pwd()}, EXISTS: ${new File(pwd()).exists()}"
              echo "WS_TMP: ${pwd(tmp: true)}, EXISTS: ${new File(pwd(tmp: true)).exists()}"
              echo "CWD: ${new File('.').absolutePath}"
              echo "USER_DIR: ${System.getProperty('user.dir')}"
         }
      } 
      1. Uncheck "Use Groovy Sandbox" 
      2. Run the job

      Expected result: workspace directory exists

      Actual result: workspace directory does not exist

      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] Start of Pipeline
      [Pipeline] node
      Running on Jenkins in /var/lib/jenkins/jobs/automation/jobs/test2/workspace
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Prepare)
      [Pipeline] pwd
      [Pipeline] pwd
      [Pipeline] echo
      WS: /var/lib/jenkins/jobs/automation/jobs/test2/workspace, EXISTS: false
      [Pipeline] pwd
      [Pipeline] pwd
      [Pipeline] echo
      WS_TMP: /var/lib/jenkins/jobs/automation/jobs/test2/workspace@tmp, EXISTS: false
      [Pipeline] echo
      CWD: /.
      [Pipeline] echo
      USER_DIR: /
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS 

       

      Steps to reproduce for declarative pipeline

      1. Create pipeline job
      2. Put the following script into "Pipeline Script" field
       pipeline {
          agent any
          stages {
              stage ('Prepare') {
                  steps {
                      echo "WS: ${pwd()}, EXISTS: ${new File(pwd()).exists()}"
                      echo "WS_TMP: ${pwd(tmp: true)}, EXISTS: ${new File(pwd(tmp: true)).exists()}"
                      echo "CWD: ${new File('.').absolutePath}"
                      echo "USER_DIR: ${System.getProperty('user.dir')}"
                  }
              }
          }
      }
      1. Uncheck "Use Groovy Sandbox" 
      2. Run the job

      Expected result: workspace directory exists

      Actual result: workspace directory does not exist

       Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] Start of Pipeline
      [Pipeline] node
      Running on Jenkins in /var/lib/jenkins/jobs/automation/jobs/test/workspace
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Prepare)
      [Pipeline] pwd
      [Pipeline] pwd
      [Pipeline] echo
      WS: /var/lib/jenkins/jobs/automation/jobs/test/workspace, EXISTS: false
      [Pipeline] pwd
      [Pipeline] pwd
      [Pipeline] echo
      WS_TMP: /var/lib/jenkins/jobs/automation/jobs/test/workspace@tmp, EXISTS: false
      [Pipeline] echo
      CWD: /.
      [Pipeline] echo
      USER_DIR: /
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS

          [JENKINS-56867] Jenkins does not allocate workspace for neither declarative pipeline nor scripted pipeline jobs

          Sergey Zhemzhitsky created issue -
          Sergey Zhemzhitsky made changes -
          Description Original: Pipeline jobs do not allocate workspace automatically

          Steps to reproduce for *scripted pipeline*
           # Create pipeline job
           # Put the following script into "Pipeline Script" field

          {code:java}
          node {
             stage('Prepare') {
                  echo "WS: ${pwd()}, EXISTS: ${new File(pwd()).exists()}"
                  echo "WS_TMP: ${pwd(tmp: true)}: ${new File(pwd(tmp: true)).exists()}"
                  echo "CWD: ${new File('.').absolutePath}"
                  echo "USER_DIR: ${System.getProperty('user.dir')}"
             }
          } {code}

           # Uncheck "Use Groovy Sandbox" 
           # Run the job

          Expected result: workspace directory exists

          Actual result: workspace directory does not exist
          {code:java}
          Running in Durability level: MAX_SURVIVABILITY
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in /var/lib/jenkins/jobs/automation/jobs/test2/workspace
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Prepare)
          [Pipeline] pwd
          [Pipeline] pwd
          [Pipeline] echo
          WS: /var/lib/jenkins/jobs/automation/jobs/test2/workspace, EXISTS: false
          [Pipeline] pwd
          [Pipeline] pwd
          [Pipeline] echo
          WS_TMP: /var/lib/jenkins/jobs/automation/jobs/test2/workspace@tmp: false
          [Pipeline] echo
          CWD: /.
          [Pipeline] echo
          USER_DIR: /
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS {code}
           

          Steps to reproduce for *declarative* *pipeline*
           # Create pipeline job
           # Put the following script into "Pipeline Script" field

          {code:java}
           pipeline {
              agent any
              stages {
                  stage ('Prepare') {
                      steps {
                          echo "WS: ${pwd()}, EXISTS: ${new File(pwd()).exists()}"
                          echo "WS_TMP: ${pwd(tmp: true)}: ${new File(pwd(tmp: true)).exists()}"
                          echo "CWD: ${new File('.').absolutePath}"
                          echo "USER_DIR: ${System.getProperty('user.dir')}"
                      }
                  }
              }
          }{code}

           # Uncheck "Use Groovy Sandbox" 
           # Run the job

          Expected result: workspace directory exists

          Actual result: workspace directory does not exist
          {code:java}
           Running in Durability level: MAX_SURVIVABILITY
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in /var/lib/jenkins/jobs/automation/jobs/test/workspace
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Prepare)
          [Pipeline] pwd
          [Pipeline] pwd
          [Pipeline] echo
          WS: /var/lib/jenkins/jobs/automation/jobs/test/workspace, EXISTS: false
          [Pipeline] pwd
          [Pipeline] pwd
          [Pipeline] echo
          WS_TMP: /var/lib/jenkins/jobs/automation/jobs/test/workspace@tmp: false
          [Pipeline] echo
          CWD: /.
          [Pipeline] echo
          USER_DIR: /
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS{code}
          New: Pipeline jobs do not allocate workspace automatically

          Steps to reproduce for *scripted pipeline*
           # Create pipeline job
           # Put the following script into "Pipeline Script" field

          {code:java}
          node {
             stage('Prepare') {
                  echo "WS: ${pwd()}, EXISTS: ${new File(pwd()).exists()}"
                  echo "WS_TMP: ${pwd(tmp: true)}, EXISTS: ${new File(pwd(tmp: true)).exists()}"
                  echo "CWD: ${new File('.').absolutePath}"
                  echo "USER_DIR: ${System.getProperty('user.dir')}"
             }
          } {code}
           # Uncheck "Use Groovy Sandbox" 
           # Run the job

          Expected result: workspace directory exists

          Actual result: workspace directory does not exist
          {code:java}
          Running in Durability level: MAX_SURVIVABILITY
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in /var/lib/jenkins/jobs/automation/jobs/test2/workspace
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Prepare)
          [Pipeline] pwd
          [Pipeline] pwd
          [Pipeline] echo
          WS: /var/lib/jenkins/jobs/automation/jobs/test2/workspace, EXISTS: false
          [Pipeline] pwd
          [Pipeline] pwd
          [Pipeline] echo
          WS_TMP: /var/lib/jenkins/jobs/automation/jobs/test2/workspace@tmp, EXISTS: false
          [Pipeline] echo
          CWD: /.
          [Pipeline] echo
          USER_DIR: /
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS {code}
           

          Steps to reproduce for *declarative* *pipeline*
           # Create pipeline job
           # Put the following script into "Pipeline Script" field

          {code:java}
           pipeline {
              agent any
              stages {
                  stage ('Prepare') {
                      steps {
                          echo "WS: ${pwd()}, EXISTS: ${new File(pwd()).exists()}"
                          echo "WS_TMP: ${pwd(tmp: true)}, EXISTS: ${new File(pwd(tmp: true)).exists()}"
                          echo "CWD: ${new File('.').absolutePath}"
                          echo "USER_DIR: ${System.getProperty('user.dir')}"
                      }
                  }
              }
          }{code}
           # Uncheck "Use Groovy Sandbox" 
           # Run the job

          Expected result: workspace directory exists

          Actual result: workspace directory does not exist
          {code:java}
           Running in Durability level: MAX_SURVIVABILITY
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in /var/lib/jenkins/jobs/automation/jobs/test/workspace
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Prepare)
          [Pipeline] pwd
          [Pipeline] pwd
          [Pipeline] echo
          WS: /var/lib/jenkins/jobs/automation/jobs/test/workspace, EXISTS: false
          [Pipeline] pwd
          [Pipeline] pwd
          [Pipeline] echo
          WS_TMP: /var/lib/jenkins/jobs/automation/jobs/test/workspace@tmp, EXISTS: false
          [Pipeline] echo
          CWD: /.
          [Pipeline] echo
          USER_DIR: /
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS{code}
          Jesse Glick made changes -
          Component/s New: workflow-durable-task-step-plugin [ 21715 ]
          Component/s Original: pipeline [ 21692 ]
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]
          Labels New: api
          Priority Original: Critical [ 2 ] New: Minor [ 4 ]
          Jesse Glick made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            Unassigned Unassigned
            szhem Sergey Zhemzhitsky
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: