On Thu, Aug 6, 2015 at 8:28 AM, Rafael Ribeiro Rezende
<
rafael...@gmail.com> wrote:
> I need to get my JAVA_HOME environment variable from within my MyPublisher
> plugin's perform method. So, I do the following:
>
> EnvVars env = run.getEnvironment(listener);
`Run.getEnvironment` produces the environment variables defined for
the build as a whole. These are generally quite limited: `BUILD_TAG`,
that sort of thing. It will never reflect anything set _within_ the
flow, because that is specific to the `StepContext` (consider that you
could use `withEnv` inside one branch of a `parallel` step).
From a `StepExecution`, you would just `@StepContextParameter private
EnvVars env;` to get access to the contextual environment variables.
This is not available to a `SimpleBuildStep`, however. And that is
tracked as:
https://issues.jenkins-ci.org/browse/JENKINS-29144