How to label to restrict build to slave nodes to use by using parameterized build
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).
ltfishie
Updated on August 01, 2022Comments
-
ltfishie over 1 year
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:
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?
-
ltfishie about 12 yearsThanks I will give that a try. Or maybe I should just learn how to develop a Jenkins plugin and do it myself....
-
Montells almost 10 yearsmichael-prokop.at/blog/2014/03/01/… this guy have same problem with elegant solution