Avadh
Avadh

Reputation: 61

How to call a jenkins Job based on User inputs

The issue here is once the first Job in a Jenkins pipeline is done, we need to ask some inputs from user and based on the user Inputs to decide the next job to be triggered(Job2 or Job3) tried build flow and parameterzied trigger plugin but didn't find any suitable option under these. Any other plugin or jenkins feature which can help in achieving the above scenario?

Upvotes: 2

Views: 11107

Answers (2)

stephen newman
stephen newman

Reputation: 593

There are a few plugins I have tried which collect user input on manually triggered jobs in a build pipeline: Active Choices Plug-in 1.2 and Extensible Choice Parameter 1.3.2.

With Active Choices you define a list of selections and a default value. With Extensible Choice Parameter you can have a text box and a default value.

This is how they work for me in Build Pipeline 1.4.8 on jenkins 1.628

  1. If you run the manual step directly in the pipeline the default is used and other parameters propagate through correctly.
  2. If you open the step there is an option to Build with Parameters which will ask for the user input. This works but other parameters like the build number do not propagate through so the pipeline is broken, and the pipeline screen does not show the status.

Upvotes: 2

Slav
Slav

Reputation: 27505

Jenkins will never pause and ask a user for inputs. It is an automated build system. It doesn't expect anyone sitting at the console watching the progress.

You can provide "inputs" or parameters when you manually trigger the job, i.e on the first job in your pipeline. You can them pass these parameters to downstream jobs, either through the Parameterized Trigger plugin or through a file copied between jobs.

If you need a human decision in the middle of your build flow, consider Promoted Builds plugin. With this plugin, a human can select a build, and then decide which "Promotion" to execute (which could branch your workflow as you need). The promotions can also be automated if needed, based on criteria and not human input.

Upvotes: 0

Related Questions