Jenkins‎ > ‎

Jenkins Interactive Job

By a "Jenkins Interactive job" we mean a job which queries the user for a number of parameters to run the job, and is quite simple to configure by configuring the job to be parameterized.

But if you need to change the choice list dynamically, you'll need to install the Extended Choice Parameter plugin and do an additional tweak.

This plugin supports that you put the choices in a file, but at least I found it a bit to get it right.

By using the plugin we do not get a truely interactive job submission, but if the choices file is frequently updated we can now mimic the functionality  - at least good enough for the case in question, so what we did was to create another job that fires on a schedule and updates the properties file. We also add the update job as a downstream job for the "interactive" job, because running this job, actually modifies the choices available.

Here is how to create Jenkins Interactive job.

  • Firstly install the Extended Choice Parameter Plugin
  • The create a job which writes a file to a location reachable by Jenkins (i.e. a file share) See Format of property file for the required format of that file.
  • Then create a job which is parameterized, and select the Extended Choice Parameter type, and you get something like this:

  • In this example, I named my Choice Parameter "VIEW_SELECTED", and asked the plugin to look for key "quarantined"
  • Finally - before giving the job to the users - add the "property file update job" as a downstream project (Look in post-build action, trigger another build

When I later choose to build the job I will be prompted with something like this:

  • and the choice I select will become accessible at runtime in the environment variable "VIEW_SELECTED"

Subpages (1): Format of property file