Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41446

ws step does not update WORKSPACE environment variable

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Trivial 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

            blatinville Bertrand Latinville
            philmcardlecg Phil McArdle
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: