I have a Spinnaker pipeline that, at the moment, contains two stages: one that runs some tests, and another that will create an automatic gerrit commit.
This pipeline takes in a chart version from a parent pipeline using ${trigger['parameters']['CHART_VERSION']}
This will provide the Jenkins job in the first stage the version to test.
I am also looking to create a gerrit commit after the tests run, but only if the version matches a certain pattern - if I want this stage to run if the version is in the format x.xx.x+x but to be skipped if the version is in the format x.xx.x-x
I have tried the following so far:
- ${trigger.parameters['CHART_VERSION']:contains('+')}
- ${trigger.parameters['CHART_VERSION'] matches '.*\\\\+.*'}
- ${fn:contains(trigger['parameters']['CHART_VERSION'], '+')}
All of which will skip the stage even though I want to run this stage if the version contains a +
Does anyone know of a way to do the above? Or would I have to resort to adding some logic in the Jenkins job to run the job if the version contains a +?