Extract parameters from properties file

I have several jobs with Jenkins parameters that use the same parameters and parameter values. When I need to change the default value for one of these parameters, I need to go through all these tasks and reconfigure them.

A simple solution to this problem would be to choose to extract all the parameters from the configuration file (in the master / in workspace), but I could not find a sufficient implementation for this.

I want to be able to combine the assembly with the standard Java configuration file (in the format "key" = "value") , and then refer to these parameters, as well as to all other parameters during the assembly.

Do you know about a suitable solution?

+7
source share
2 answers

Use the EnvInject Plugin to read your parameters from a file as environment variables during the construction phase of the Inject Environment variables. The failure is that then you cannot easily redefine them. One solution would be to use it in conjunction with the conditional BuildStep plugin . Then you can define the boolean parameter OVERRIDE, which will be false by default. Then you can execute your Inject assembly step conditionally only if OVERRIDE is false. When you need to override your parameters with the values ​​provided manually (in a user call to start the task), specify the override values ​​and set OVERRIDE to true.

+9
source

I use hudson with ant and set parameters (client) in my hudson work. This parameter is the name of the properties file that I open with ant as follows:

<loadproperties> srcFile="${project.dir}/build/resources/${customer}.properties"/> 
+1
source

All Articles