-
Improvement
-
Resolution: Not A Defect
-
Minor
-
*OS*
{code}
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.5 LTS"
VERSION_ID="14.04"
{code}
*JVM*
{code}
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
{code}
*Jenkins*
{code}
ver. 2.168
{code}
*Plugins*
{code}
Pipeline 2.6
Pipeline Graph Analysis Plugin 1.9
Pipeline Utility Steps 2.3.0
Pipeline: API 2.33
Pipeline: Basic Steps 2.15
Pipeline: Build Step 2.8
Pipeline: Declarative 1.3.7
Pipeline: Declarative Agent API 1.1.1
Pipeline: Declarative Extension Points API 1.3.7
Pipeline: Groovy 2.64
Pipeline: Input Step 2.10
Pipeline: Job 2.32
Pipeline: Milestone Step 1.3.1
Pipeline: Model API 1.3.7
Pipeline: Multibranch 2.21
Pipeline: Multibranch with defaults 2.0
Pipeline: Nodes and Processes 2.29
Pipeline: REST API Plugin 2.10
Pipeline: SCM Step 2.7
Pipeline: Shared Groovy Libraries 2.13
Pipeline: Stage Step 2.3
Pipeline: Stage Tags Metadata 1.3.7
Pipeline: Stage View Plugin 2.10
Pipeline: Step API 2.19
Pipeline: Supporting APIs 3.2
{code}*OS* {code} NAME="Ubuntu" VERSION="14.04.5 LTS, Trusty Tahr" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 14.04.5 LTS" VERSION_ID="14.04" {code} *JVM* {code} java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) {code} *Jenkins* {code} ver. 2.168 {code} *Plugins* {code} Pipeline 2.6 Pipeline Graph Analysis Plugin 1.9 Pipeline Utility Steps 2.3.0 Pipeline: API 2.33 Pipeline: Basic Steps 2.15 Pipeline: Build Step 2.8 Pipeline: Declarative 1.3.7 Pipeline: Declarative Agent API 1.1.1 Pipeline: Declarative Extension Points API 1.3.7 Pipeline: Groovy 2.64 Pipeline: Input Step 2.10 Pipeline: Job 2.32 Pipeline: Milestone Step 1.3.1 Pipeline: Model API 1.3.7 Pipeline: Multibranch 2.21 Pipeline: Multibranch with defaults 2.0 Pipeline: Nodes and Processes 2.29 Pipeline: REST API Plugin 2.10 Pipeline: SCM Step 2.7 Pipeline: Shared Groovy Libraries 2.13 Pipeline: Stage Step 2.3 Pipeline: Stage Tags Metadata 1.3.7 Pipeline: Stage View Plugin 2.10 Pipeline: Step API 2.19 Pipeline: Supporting APIs 3.2 {code}
Pipeline jobs do not allocate workspace automatically
Steps to reproduce for scripted pipeline
- Create pipeline job
- 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')}" } }
- Uncheck "Use Groovy Sandbox"
- 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
- Create pipeline job
- 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')}" } } } }
- Uncheck "Use Groovy Sandbox"
- 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