jenkinsci / jenkinsci/workflow-basic-steps-plugin
[JENKINS-58367] cwd set by exws set is replaced by withEnv and withCredentials steps
- Dominant language
- Java
- Stars
- 73
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am experiencing an unexpected change of the current working directory when withEnv or withCredentials steps are used.
dir step is a viable workaround, but I am wondering if there is a more straightforward explanation and solution.
Thank you!
—
def extWorkspace = exwsAllocate diskPoolId: 'workspace-pool', strategy: fastestWriteSpeed()
stage('init') {
node('brenode') {
println pwd() //prints local workspace (${JENKINS_HOME}/workspace/${JOB_NAME})
exws (extWorkspace) {
println pwd() //prints external workspace ${physical_path}/${JOB_NAME}/${BUILD_NUMBER}
withEnv(["1=1"])
{ println pwd() //prints again local workspace! }
}
}
}
---
Originally reported by claudiuavat1, imported from: cwd set by exws set is replaced by withEnv and withCredentials steps
alexsomai
Raw content of original issue
Hi,
I am experiencing an unexpected change of the current working directory when withEnv or withCredentials steps are used.
dir step is a viable workaround, but I am wondering if there is a more straightforward explanation and solution.
Thank you!
—
def extWorkspace = exwsAllocate diskPoolId: 'workspace-pool', strategy: fastestWriteSpeed()
stage('init') {
node('brenode') {
println pwd() //prints local workspace (${JENKINS_HOME}/workspace/${JOB_NAME})
exws (extWorkspace) {
println pwd() //prints external workspace ${physical_path}/${JOB_NAME}/${BUILD_NUMBER}
withEnv(["1=1"]){ println pwd() //prints again local workspace! }
}
}
}
environment
```
JENKINS_VERSION 2.176.1
external-workspace-manager 1.1.2
workflow-basic-steps 2.18
```
Contributor guide
Assessment
This issue has not been assessed yet.