WORKSPACE not defined properly when node steps are nested inside other node steps

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

XMLWordPrintable

      we have a linux node and some k8s defined. no relation between them or their file systems.

      we have a scripted pipeline which looks like this:

      node("some_linux_node")
      {
          println "pwd = " + pwd()
          println "env.WORKSPACE = " + env.WORKSPACE
          podTemplate(/define any container you want here... DON'T specify the workspace path/)
          {
              println "pwd = " + pwd()         
              println "env.WORKSPACE = " + env.WORKSPACE /// here we think there is a problem...     
          }
      }
      

      the output of this looks like:

      pwd = /workspace_on_node

      env.WORKSPACE = /workspace_on_node

      pwd = /workspace_inside_container

      env.WORKSPACE = /workspace_on_node

       

      I expected the last line to show the exact same location as the third line (pwd in the container).

      I expect that the podTemplate scope, once running, should set the env.WORKSPACE variable to the actual workspace, and only when the scope ends, the value returns to be the one it was before (on the node...).

      the behavior we expect is what we see when hopping between nodes (node section inside another node section).

            Assignee:
            Unassigned
            Reporter:
            Amit Dar
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: