Jenkins Flexible Publish plugin if else condition

2.4k Views Asked by At

I am using the flexible publish plugin for jenkins and found it very useful. My goal is to pass a set of predefined parameters from a job to trigger another downstream job. The downstream job performs an action based on the string match evaluation. But if i dont pass the parameters the job would fail saying

Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'multinodeind' in '${multinodeind}'], action = [Fail the build]

I want to do an if else flow. If the parameter is present evaluate it and proceed. Otherwise perform another action. Any clue?

1

There are 1 best solutions below

1
On BEST ANSWER

You know you can add parameters with default values under Meta Data → ☑ This build is parameterizedAdd parameter, do you? The default values are supposed to be taken if a value for a parameter isn't passed, IIRC.

However, you can use the Conditional BuildStep Plugin in the project configuration's Build section:

A buildstep wrapping any number of other buildsteps, controlling their execution based on a defined condition.