On Sun, Apr 8, 2018 at 4:00 AM 'Sandra Parsick' via Jenkins Users < jenkinsci-users@googlegroups.com> wrote:
> Hello, > > I'd like to change the current workspace in a pipeleine script. > See the ws() directive https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#code-ws-code-allocate-workspace See also https://stackoverflow.com/questions/43627358/how-to-set-specific-workspace-folder-for-jenkins-multibranch-pipeline-projects and https://stackoverflow.com/questions/43577139/what-does-a-ws-block-do-in-jenkins Mark Waite > 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 > <https://groups.google.com/d/msgid/jenkinsci-users/63b8f006-6db3-4c90-b547-afac04d83685%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAO49JtHCOs2rBr_WaEx7xwSR__Of-2b_d3A0KgDNSm6jbDUxrg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.