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

@StepContextParameter EnvVars missing Computer.environment

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      StepContext.get(EnvVars) is advertised as an option and when run inside node you would expect it to include all environment variables associated with that Computer, but it does not: it only includes those added by Computer.buildEnvironment (node properties, JENKINS_URL), plus anything extra added by the node step (JENKINS_SERVER_COOKIE). This did not matter to sh steps because LocalLauncher.inherit started with the existing environment variables and just added in the overrides. It also did not matter for env.PATH calls from Groovy because EnvActionImpl was hardcoded as of 8eb96e8 (0.1-beta-7) to look up a Computer as a fallback value.

      I think the right fix is to make PlaceholderExecutable do the call to getEnvironment, then make EnvActionImpl look for EnvVars in the context—also giving those precedence over user settings, for consistency with DefaultStepContext.

      WorkflowTest.env is also too weak: it does not even test externally set environment variables, does not test per-slave variables (which would presumably require a mock SlaveComputer.getEnvironment override), and does not test EnvVars.override behavior (PATH+X syntax) from a block step.

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/EnvActionImpl.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/b4900072b0e49c5ba7ab6acfe3962ebbfab66fbf
            Log:
            [FIXED JENKINS-26552] Provide a full Computer.environment to @StepContextParameter EnvVars.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: cps/src/main/java/org/jenkinsci/plugins/workflow/cps/EnvActionImpl.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/b4900072b0e49c5ba7ab6acfe3962ebbfab66fbf Log: [FIXED JENKINS-26552] Provide a full Computer.environment to @StepContextParameter EnvVars.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/JenkinsRuleExt.java
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowTest.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/EnvActionImpl.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/bf05beb8010fdecc1fb67ac0d1b546f22497e6a1
            Log:
            Merge pull request #41 from jenkinsci/Computer.environment-JENKINS-26552

            JENKINS-26552 Provide a full Computer.environment to @StepContextParameter EnvVars

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/22053bde0721...bf05beb8010f

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/JenkinsRuleExt.java aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowTest.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/EnvActionImpl.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/bf05beb8010fdecc1fb67ac0d1b546f22497e6a1 Log: Merge pull request #41 from jenkinsci/Computer.environment- JENKINS-26552 JENKINS-26552 Provide a full Computer.environment to @StepContextParameter EnvVars Compare: https://github.com/jenkinsci/workflow-plugin/compare/22053bde0721...bf05beb8010f
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStepTest.java
            http://jenkins-ci.org/commit/credentials-binding-plugin/2fe481bbc1f7866448730fc3d89c66a246ebb14e
            Log:
            [FIXED JENKINS-27389] Confirming that fix of JENKINS-26552 solved this as well.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStepTest.java http://jenkins-ci.org/commit/credentials-binding-plugin/2fe481bbc1f7866448730fc3d89c66a246ebb14e Log: [FIXED JENKINS-27389] Confirming that fix of JENKINS-26552 solved this as well.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java
            http://jenkins-ci.org/commit/workflow-plugin/74b51c42dba52952b84b73b978cb562a1bb63ad5
            Log:
            Adding some tests. Fails without a fix of JENKINS-26552.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java http://jenkins-ci.org/commit/workflow-plugin/74b51c42dba52952b84b73b978cb562a1bb63ad5 Log: Adding some tests. Fails without a fix of JENKINS-26552 .
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java
            http://jenkins-ci.org/commit/workflow-basic-steps-plugin/a3c512992b545138cd151efef9b97741cb1f7540
            Log:
            Adding some tests. Fails without a fix of JENKINS-26552.
            Originally-Committed-As: 74b51c42dba52952b84b73b978cb562a1bb63ad5

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/a3c512992b545138cd151efef9b97741cb1f7540 Log: Adding some tests. Fails without a fix of JENKINS-26552 . Originally-Committed-As: 74b51c42dba52952b84b73b978cb562a1bb63ad5
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/EnvActionImpl.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/3e18af5bb48423fea36c45a5fb0fecfca081b425
            Log:
            [FIXED JENKINS-26552] Provide a full Computer.environment to @StepContextParameter EnvVars.
            Originally-Committed-As: b4900072b0e49c5ba7ab6acfe3962ebbfab66fbf

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: cps/src/main/java/org/jenkinsci/plugins/workflow/cps/EnvActionImpl.java http://jenkins-ci.org/commit/workflow-cps-plugin/3e18af5bb48423fea36c45a5fb0fecfca081b425 Log: [FIXED JENKINS-26552] Provide a full Computer.environment to @StepContextParameter EnvVars. Originally-Committed-As: b4900072b0e49c5ba7ab6acfe3962ebbfab66fbf

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: