How to add variable into build environment variables during execution

29 views
Skip to first unread message

文宾 王·

unread,
Aug 26, 2015, 8:57:54 AM8/26/15
to Jenkins Developers
Hi all,

I would like to put some our own variables into jenkins job build
environment variables during build execution. how could I do it? how
to access the jenkins object model?

Saying, I have a job named A, and we run a java application as its
step, in the java application, I need to put some own variables into
the build environment variables during build execution, these
variables might be transferred
to downstream jobs by existing plugin.

So, how to add variables into build env variables?
what`s the extension points for that?

I found BuildVariableContributor, might be it is the extension point to add my variables into build env, but when and how would it be triggered? since I need to trigger adding variables from my java application, how to do it? is it possible to get the handle of running build of given name job?

Thanks for any clues.

Thanks

Regards,
Grrison

Victor Martinez

unread,
Aug 26, 2015, 11:20:51 AM8/26/15
to Jenkins Developers
Hi,

I guess you can use the below plugins:


You can either create a properties file during the build process and run a postbuild action -> Trigger another projects based on a properties file, or inject those properties using the env inject plugin and another post build action with those parameters.

There are different approaches but those are the ones off the top of my head.

Cheers

文宾 王·

unread,
Aug 27, 2015, 8:44:17 AM8/27/15
to Jenkins Developers
thanks Victor, that really help, we use predefined parameters mode to pass values to downstream previously, so i was seeking a way to put into build env during execution to make the passing down happen, since the plugin could transfer properties file, that' s nice!
thank you

Oleg Nenashev

unread,
Aug 27, 2015, 8:51:48 AM8/27/15
to Jenkins Developers
BTW use jenkinsci-users mailing list or IRC for such discussions. This mailing list is for discussions about Jenkins core and plugins development.

четверг, 27 августа 2015 г., 15:44:17 UTC+3 пользователь 文宾 王· написал:
Reply all
Reply to author
Forward
0 new messages