81204

Pass values to Jenkins parameter from a file

Question:

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 ?

Answer1:

Use <a href="https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin" rel="nofollow">Extended Choice Parameter Plugin</a> - 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.

Answer2:

<ol><li>Add the Plugin Extended choice Parameter as stated by antweisis</li> <li>Need a Property files which means the file with the content in following format Eg: dates=21012,2013,2014,2015</li> <li>I have added the Image with how I have Configured the jobs as shown in the image bellow. </li> <li>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.</li> </ol>

<a href="https://i.stack.imgur.com/ndGOy.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/ndGOy.png" data-original="https://i.stack.imgur.com/ndGOy.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Where,

<strong>Delimiter</strong> = comma as we have comma separated the values

<strong>Propertyfile</strong> = path to the files

<strong>Propertykey</strong> = 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.

Recommend

  • Iterating through edge weights of a const boost::graph
  • Invalid Django TIME_ZONE
  • how to list posts from database in android using ListActivity?
  • Calling a web server inside Jupyterhub without connection failed
  • getsockname return invalid address
  • How to extend Sequelize model
  • Match every instance of regex in BASH
  • How do you change SubSonic 3's connection string on the fly?
  • How to load PDFs from Documents Directory?
  • Proper Form of API request to Blogger using Java/App Engine -error 401
  • How to define redirect page for protected pages
  • jqgrid - treegrid for flat structure data
  • Select Checkbox !== Select Row Table
  • Django activity stream filter Actions by foreignkey in target model
  • COM Interop hang freezes entire COM system. How to cancel COM call
  • Selenium - how to switch to a different (login) window that is brought up?
  • Unable to generate cucumber reports in jenkins. net.masterthought.cucumber.ValidationException: None
  • Adding custom message on Thank You page by shipping method
  • What is the diff. between default.properties and project.properties?
  • Making query to find nearest multiple(Lat,Long) from the single(Lat,Long)
  • How to delete first 7 characters of folder name by using batch script?
  • Passing HTTP Post from AWS API GW to Lambda
  • How to implement Google Drive and Google Plus sdk in ios project
  • jQuery Ajax call to WCF service returning “Method not allowed (405)”
  • Query regarding com.jcraft.jsch.JSchException: UnknownHostKey: x.y.com. DSA key fingerprint is “ac:e
  • Modifying native query cannot have named parameter bindings?
  • Adding native code to an existing Worklight hybrid app
  • Swift manually rotate view controller
  • Query takes almost two seconds but matches only two rows - why isn't the index helping?
  • Copy and paste data from multiple workbooks to a worksheet in another Workbook
  • What is the difference between dynamically creating a script tag and statically embed a script tag?
  • java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/SpringDispatcher-ser
  • concise way of flattening multiindex columns
  • Will this work on all screen sizes?
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • matrix multiplication apache pig
  • Send array to next viewcontroller iOs xcode [duplicate]
  • Comma decimal separator is ignored by ASP.NET MVC model binder
  • multiple button click in asp.net MVC 3
  • Running R's aov() mixed effects model from Python using rpy2