Reputation: 4318
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.
Upvotes: 2
Views: 2175
Reputation: 1326696
You can test first your regexp in regex101.com
: adding a (?i)
in the middle of it won't work.
As explained in "Grails/Groovy regular expression- how to use (?i) to make everything case insensitive?", you need to put it at the beginning.
(?i)^([0-9]{5}-)?external-resources-.*
Upvotes: 2