On Thu, Aug 6, 2015 at 8:28 AM, Rafael Ribeiro Rezende
<[email protected]> 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

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2RZTr%2BMBNiSd6NEytHtVnXLbS33sM3a%3D-G92DpAL5tFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to