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

Global EnvironmentVariableNodeProperty does not show up in Pipeline unless in a node {...} block

XMLWordPrintable

      If you have a global environment variable set (let's say SOME_VAR="hi" for this example) in the Jenkins global configuration, that variable will not be in the Pipeline environment until you enter a node block, albeit any node block. So, for example,

      echo "SOME_VAR outside is ${env.SOME_VAR}"
      node {
        echo "SOME_VAR inside is ${env.SOME_VAR}"
      }

      will output

      SOME_VAR outside is null
      SOME_VAR inside is hi

      So I think WorkflowRun needs to include Jenkins.getInstance().getGlobalNodeProperties() when creating its initial environment.

            abayer Andrew Bayer
            abayer Andrew Bayer
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: