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

@StepContextParameter EnvVars missing Computer.environment

      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.

          [JENKINS-26552] @StepContextParameter EnvVars missing Computer.environment

          Jesse Glick created issue -
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Link New: This issue is blocking JENKINS-24673 [ JENKINS-24673 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 41 (Web Link)" [ 12031 ]
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          Jesse Glick made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Jesse Glick made changes -
          Status Original: Reopened [ 4 ] New: Open [ 1 ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-27389 [ JENKINS-27389 ]
          Jesse Glick made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 160623 ] New: JNJira + In-Review [ 196503 ]

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

              Created:
              Updated:
              Resolved: