Jenkins - Dont build for specific commiter or commit message Jenkins - Dont build for specific commiter or commit message jenkins jenkins

Jenkins - Dont build for specific commiter or commit message


Jenkins git plugin itself already provides these kinds of advanced usage.

Exclude specific messages

Job config page -->Source Code Management-->Git-->Add -->Polling ignores commits with certain messages

Exclude specific commiters

Job config page -->Source Code Management-->Git-->Add -->Polling ignores commits from certain users

Don't forget to click the help at the end of each of them to learn the correct way of usage.


If you have not yet found a solution:

  1. Configure your job to poll SCM but do not enter a timeplan for that (ignoring the warning that your job would never run.

  2. Configure the scm section to ignore commits, users, etc.

  3. Use a trigger for your jobs as follows: http://yourserver/git/notifyCommit?url=<URL of the Git repository>[&branches=branch1[,branch2]*][&sha1=<commit ID>] as seen on Git Plugin page

Whenever the URL is called, jenkins will scan for jobs that are using this repository. Then it checks for any specific settings (e. g. ignoring commits by certain users or with some commit messages) and either run the build or not. Of course the build will always somehow start to poll scm and check for commits, but if it is cancelled due to unimportant commits you will not see an aborted build in your history.


You will need to use external script.

Pull out the project (git clone/fetch) and then before continuing with your build check to see if the specific message is in your repository.

To check to see if your message is there you can use the git show or git log commands.

git log

git log --all --grep='<your message>'# and you can add more flags if you want of course:git log --all --oneline | grep '<your message>'

git grep

git grep '<your message>' $(git rev-list --all)

Outside of Jenkins

Add code to git hook which check what you want to find *messages, commit etc) and only if it find it call Jenkins via REST API and start your job.

This is the way im using Jenkins, i check for something that i looking for and then im invoking Jenkins via API

Read more here & here