I have a Jenkins Pipeline with a stage that shall only be executed when a certain keyword ("[test]") is found in the git commit message.
Due to Documentation this can be done with a simple when-Directive using the Built-in 'changelog'-Condition with a regex pattern.
The Condition in my Jenkinsfile looks like this:
This works great as long as the git commit message is not multi-line! Otherwise the stage is always skipped (at least if the keyword is not in the first line).