ws step does not update WORKSPACE environment variable

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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

            Assignee:
            Bertrand Latinville
            Reporter:
            Phil McArdle
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: