Jenkinsfile stage when branch regex not working

Viewed 1199

I have a declarative jenkinsfile setup and one of the stages I need to run when the branch has a certain naming convention. For some reason the stage is not running with the when block added as shown below:

when {
  branch pattern: '^([0-9]{5}-)?(?i)external-resources-.*',
  comparator: 'REGEXP'
}

So the example above I would like the stage to run when the branch matches anything that has the name external-resources in it. All other branches should be ignored.

Thank you for any help you can provide.

1 Answers
Related