Search code examples
jenkinscloudbeesjenkins-workflow

How do we access Jenkins workflow input parameter values?


Presumably the parameters that are specified in a Jenkins workflow input step are available for consumption and conditional logic? How do we obtain those values? e.g. how do we obtain and reference true or false value for the checkbox parameter in the following:

input id: 'Proceed1', message: 'Proceed or abort?', parameters: [[$class: 'BooleanParameterDefinition', defaultValue: false, description: '', name: 'Please confirm you agree with this']]

Solution

  • The return value of the input step will be the submitted value (a boolean, in the case of BooleanParameterDefinition). If there are multiple parameters, you get a Map so you can look up the value of each by name.

    By the way you can skip parameters altogether if you simply want OK/Cancel semantics, as your example seems to imply. If the user cancels, the flow aborts. If they accept, there is no return value (well, null technically).