-
Improvement
-
Resolution: Fixed
-
Trivial
-
None
-
Jenkins LTS ver. 2.32.1
Nodes and Processes Plugin 2.8
I consider this a bug, but feel free to reclassify.
node { ws ('workspace/customDir') { println "workspace: ${env.WORKSPACE}" } }
[Pipeline] node Running on <node> in E:\JenkinsRoot\workspace\Experiments\Test_Workspace [Pipeline] { [Pipeline] ws Running in E:\JenkinsRoot\workspace\customDir [Pipeline] { [Pipeline] echo workspace: E:\JenkinsRoot\workspace\Experiments\Test_Workspace [Pipeline] } [Pipeline] // ws [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS
I can't find a way, in code, to get the path to the workspace after using the ws step. At the moment the only way I've found is to run a batch or shell script and get the current working directory from there.
Please tell me if I'm missing something
I was about to open this issue, I faced it yesterday.
I had a look in the code of WorkspaceStepExecution.java and tried to inject the new workspace path value in the environment, with
this commit:
https://github.com/blatinville/workflow-durable-task-step-plugin/commit/80886255fb283f272a1726001a37989185f7a9e4
Using this pipeline:
WORKSPACE is correct after, BUT, NODE_NAME is set to null in the ws() step.
Need to find something better.