How to create a set of Jenkins variables based on one chosen parameter?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to create a set of Jenkins variables based on one chosen parameter?



I'm using a jenkins freestyle project which has parameterized build enabled.



enter image description here



How can I create a set of variables based on the chose parameter?



For example:



When the parameter param1 is chosen, I want the set of variables to be equal to


param1


CONFIG=config_a.yml
AWS_PROFILE=aws-profile-aa
ANT_BUILD_FILE=buildA



When param2 is chosen, the above set of variables should be set to


param2


CONFIG=config_b.yml
AWS_PROFILE=aws-profile-bb
ANT_BUILD_FILE=buildB



CONFIG, AWS_PROFILE, and ANT_BUILD_FILE variables will be accessed in Execute shell, and Invoke Ant.


CONFIG


AWS_PROFILE


ANT_BUILD_FILE


Execute shell


Invoke Ant



enter image description here



enter image description here



I don't want to define 3 parameters like this



enter image description here



Because my jenkins project should never build with CONFIG=config_a.yml and AWS_PROFILE=aws-profile-bb together.


CONFIG


config_a.yml


AWS_PROFILE


aws-profile-bb




2 Answers
2



Why you not using ant? Its very easy to write build.xml file for ant



https://ant.apache.org/manual/using.html



I found that Active Choices is able to solve my problem.



This plugin can create 4 parameters like this



enter image description here



Once test_choice_parameter is changed to param2, the other 3 parameters will change accordingly.


test_choice_parameter


param2



enter image description here



Here is my configuration of Active Choices:



enter image description here



enter image description here



enter image description here



enter image description here



enter image description here






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard