Something like this I'd guess

SetEnvBuildWrapper wrapper =
job.getBuildWrappers().get(Jenkins.getInstance().getDescriptorByType(SetEnvBuildWrapper.DescriptorImpl.class))
Map<String,String> vars = wrapper.getLocalVarMap()

/B

2017-09-19 20:53 GMT+02:00 Paulo Eduardo Neves <[email protected]>:

> Earlier today I post this message to Jenkin Users mailing list. I
> mistakenly though that it were the place for plugin questions. Sorry for
> the crosspost,
>
> I have a prebuild plugin that extends ParameterDefinition class. It just
> give me some options to prepare the build.
>
> It is an old installation and uses the deprecated SetEnv plugin
> <https://wiki.jenkins.io/display/JENKINS/Setenv+Plugin> to setup a bunch
> of environment variables.
>
> Is it possible to access the environment variables defined in the *SetEnv
> plugin* from my plugin? It just creates the build object when the submit
> button is pressed, so I don't have access to it from my form.
>
> If I can access the configuration file, I can also parse these variables.
> Maybe this is easier to do.
>
> I also would like to access the Jenkins global variable values. If I do
> a System.getenv("JAVA_HOME") I get the value, but if I try with a variable
> defined in the SetEnv plugin or in the global configuration, it comes null.
>
> If you can point me an example or reference, it would be great.
>
> Thanks in advance for any help.
>
> --
> 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/917dbdc6-d11d-4277-87d8-f85468213903%
> 40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/917dbdc6-d11d-4277-87d8-f85468213903%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Robert Sandell
*Software Engineer*
*CloudBees Inc.*

-- 
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/CALzHZS3g4dv2r-40NiisAJayuNiLLdW%3DHcKk%3DGbXpamSrF65WA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to