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

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

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -
            Show
            abayer Andrew Bayer added a comment - PR up for this at  https://github.com/jenkinsci/workflow-job-plugin/pull/43
            Hide
            jglick Jesse Glick added a comment -

            I feel like this is a duplicate but I am not sure of what.

            Show
            jglick Jesse Glick added a comment - I feel like this is a duplicate but I am not sure of what.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java
            http://jenkins-ci.org/commit/workflow-job-plugin/3fd2761b483020f577b02e55ef0b766815285a95
            Log:
            [FIXED JENKINS-43396] Global NodePropertys should be in environment

            They currently show up once you enter a node block, but not for things
            outside node blocks. This fixes that by adding them to
            WorkflowRun.getEnvironment(listener).

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java http://jenkins-ci.org/commit/workflow-job-plugin/3fd2761b483020f577b02e55ef0b766815285a95 Log: [FIXED JENKINS-43396] Global NodePropertys should be in environment They currently show up once you enter a node block, but not for things outside node blocks. This fixes that by adding them to WorkflowRun.getEnvironment(listener).
            Hide
            gordin Christoph Vogtländer added a comment -

            Jesse Glick: i think #40455 is a duplicate of this one

             

            Show
            gordin Christoph Vogtländer added a comment - Jesse Glick : i think #40455 is a duplicate of this one  

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: