Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins trigger build on specific commit message of branch

I did a little search and googling for this issue, but most of the posts are related on how to isolate (by using git plugin etc.)

What I'm wondering is there a way to configure a jenkins job to trigger a build on specific commit message (let's say if it contains "build") on the branch I specified.

Thanks in advance,

like image 849
Canberk Ozcelik Avatar asked Aug 29 '17 15:08

Canberk Ozcelik


People also ask

How do I build on specific commit in git on Jenkins?

Pass the commit sha1 to a predefined parameter and in Build-Execute shell run git checkout <commit> before the build process starts. Some extra work is needed to make sure the check-out goes well. Check the box This project is parameterized and then you can add predefined parameters.

How do you trigger a Jenkins pipeline based on a git commit?

To trigger a Jenkins pipeline with a new commit to Git branch you need to add the web hook on Git repository settings and select Pushes trigger event. Or if you want Jenkins pipeline to perform some specific step on a specific branch .. you can try adding a condition in your Jenkinsfile like below..

How do I trigger a build automatically in Jenkins?

Follow the steps as mentioned below to trigger a Jenkins job automatically based on GitHub's webhook configurations: Step 1: Go to the Configuration page of the respective job and under the build trigger section, check the "GitHub hook trigger for GITScm polling" checkbox and click on the Save button.


Video Answer


1 Answers

You can use Commit Message Trigger Plugin to achieve this.

Once you install this plugin, go to your job configuration page and under Build Environment section check Enable Commit Message Trigger,then add the keyword that will cause the job to trigger.

enter image description here

like image 181
ANIL Avatar answered Nov 05 '22 17:11

ANIL