Something changed between Jenkins LTS 2.138 and 2.150 with regards to the 
workspace.
Since LTS 2.150 the workspace set by the external workspace manager plugin 
is ignored inside: stage, withEnv, withCredentials (and possibly others).
Below is an example. Inside the stage step, the workspace is not the same 
as immediately outside the stage.
I wrote the actual workspace path returned, beside each line as a comment.

The code below can also be found in 
https://gist.github.com/martinda/fae71b37dc20bcb0e239ab46de3be291

def extWorkspace
stage('Allocate Workspace') {
    extWorkspace = exwsAllocate 'diskpool1'
}

node() {                  // Running on Jenkins in 
/localdisk/martin/jenkins/jenkins/workspace/test-exws
    exws(extWorkspace {   // Running in /localdisk/martin/diskpool1/test-exws/8
        sh 'pwd'          // /localdisk/martin/diskpool1/test-exws/8
        stage("Stage") {
            sh 'pwd'      // ??? 
/localdisk/martin/jenkins/jenkins/workspace/test-exws ???
        }
        sh 'pwd'          // /localdisk/martin/diskpool1/test-exws/8
    }
}

Can someone explain why the inner-most sh step has a different workspace since 
LTS 2.150?

Thanks,
Martin

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/6402f649-89dc-4d18-88e1-e9babc61c33a%40googlegroups.com.

Reply via email to