Johan Johan - 2 months ago 25x
Git Question

Ignore Jenkins job if commit message starts with a given string

I want to ignore running a Jenkins job if the commit message starts with a given string. I've tried adding "Additional Behaviours" and "Polling ignores commits with certain messages":

enter image description here

I.e. I want to ignore the job (which in my world means don't run the job) if the commit message starts with "doc!". I've tried several online regex matchers and I think that the regex of

is correct. But even though my commit messages does start with "doc!" the job is executed by Jenkins. What am I doing wrong?


While @devanshu-dwivedi's answer might work my approach seem to work as well if I change my regex to:


I don't exactly know why this is the case. The documentation says that using (?s) checks multiple comment lines in the commit messages. But without using (?s) it don't work for me even for single commits with a one line commit message.