How to label to restrict build to slave nodes to use by using parameterized build

Go To StackoverFlow.com

4

For my Jenkins job, I have setup an environment parameter which tells my build script which configuration to use. I also have slave nodes running on each of my environments to build and deploy my application.

I have tried used the "Restrict where this project can be run" with the value

buildnode-${ENV}

where ENV is the name of my parameter. This doesn't seem to work as label does not perform substitution.

I have also tried the NodeLabel Plugin, which allows me to define which nodes to run the job from. However, this will create two separate selections:

enter image description here

Is there a way to tie this two together, so when I select QA environment, for example, the slave node for the QA server is choose to run the build?

2012-04-04 04:15
by ltfishie


3

You can try the following work-around: have two builds - A and B. A will set up the environment, save it into a file, and pass the file as a parameter to build B, along with the name of the node on which to run (the parameters will be passed via Parameterized Trigger plugin). B will read the environment (via EnvInject plugin) and run the build on the node passed as the other parameter (you do need to use NodeLabel plugin).

2012-04-04 21:22
by malenkiy_scot
Thanks I will give that a try. Or maybe I should just learn how to develop a Jenkins plugin and do it myself... - ltfishie 2012-04-04 21:51
http://michael-prokop.at/blog/2014/03/01/jenkins-on-demand-slave-selection-through-labels/ this guy have same problem with elegant solutio - montells 2014-07-22 16:11
Ads