3

I would like to know if there is an option to pass the value from a file to one of the Jenkins parameters. For eg : I have a property file called config.properties and I would like to pass the value of a field called projectName to a Jenkins parameter called Project. How can I do this ?

DSSD
  • 39
  • 1
  • 2
  • 5

2 Answers2

2

Use Extended Choice Parameter Plugin - it allows you to define a property file and and a key within the file to use. The plugin expects comma-separated values to allow the user to choose one but if there's only one value - it will be chosen by default.

antweiss
  • 2,789
  • 1
  • 13
  • 12
2
  1. Add the Plugin Extended choice Parameter as stated by antweisis
  2. Need a Property files which means the file with the content in following format Eg: dates=21012,2013,2014,2015
  3. I have added the Image with how I have Configured the jobs as shown in the image bellow.
  4. To dynamically add the content to a property file create a script and run it as cron job or run the job that will populate the file first.

enter image description here

Where,

Delimiter = comma as we have comma separated the values

Propertyfile = path to the files

Propertykey = the key we have used for our example we have used dates

This will successfully create a drop down from the content of the files.

Tara Prasad Gurung
  • 3,422
  • 6
  • 38
  • 76