EnvVars: EnvVars.getRemote(channel) does not give all values

28 views
Skip to first unread message

Dzmitry Kashlach

unread,
Jul 18, 2016, 6:54:45 AM7/18/16
to Jenkins Developers
Hi All,

Please, guide me over Jenkins API.
I have plugin which works both with master&slave.
I want to be able to pass variables to job.
I set vars in 'Manage Jenkins' -> 'Configure System'
but do not receive them when doing 'EnvVars.getRemote(VirtualChannel channel)'.

How can I grab my vars?

Please, redirected me, if this question is solved.

micha...@gmail.com

unread,
Jul 18, 2016, 11:42:31 AM7/18/16
to Jenkins Developers
Hi Dzmitry,

I am a begineer in the creation of Jenkins plugin, but maybe try to add the following line in your pom.xml:

<properties>

<jenkins.YOURNEWVAR>${env.YOURNEWVAR}</jenkins.YOURNEWVAR>

</properties>


and then you can reach it from your plugin using
System.getProperty("jenkins.YOURNEWVAR");


Also, you may have to use this plugin to create a custom environment variable: https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

Dzmitry Kashlach

unread,
Jul 19, 2016, 5:21:08 AM7/19/16
to Jenkins Developers
Solved.

build.getEnvironment(listener)

should be used.
Reply all
Reply to author
Forward
0 new messages