Hello, I'd like to change the current workspace in a pipeleine script. My naive approach is the following script
pipeline { agent any environment { WORKSPACE = '/home/sparsick' } stages { stage('Build') { steps { sh 'echo $WORKSPACE' sh 'pwd' } } } } The output of this script: Running on Jenkins <http://localhost:8001/computer/(master)/> in /home/sparsick/dev/jenkins-2.0/workspace/Workspace Change In Pipeline [Pipeline] { [Pipeline] withEnv [Pipeline] { [Pipeline] stage [Pipeline] { (Build) [Pipeline] sh [Workspace Change In Pipeline] Running shell script + echo /home/sparsick /home/sparsick [Pipeline] sh [Workspace Change In Pipeline] Running shell script + pwd /home/sparsick/dev/jenkins-2.0/workspace/Workspace Change In Pipeline [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS I expected that the output of the pwd command is the same as the output of the echo command. But It isn't. So my question how I can change the current workspace in a pipeline script? Thank you and best regards, Sandra -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/63b8f006-6db3-4c90-b547-afac04d83685%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.