Is it possible to trigger Jenkins from one specific branch only?

后端 未结 4 392
滥情空心
滥情空心 2020-12-16 23:14

My situation is the following: I have three branches in a repo: master, dev and staging. And I have one job for each one of these branches, configured in \'Branches to build

4条回答
  •  长情又很酷
    2020-12-16 23:58

    Yes!! You can trigger the jenkins build whenever there is a commit or merge into a specific branch of the git repo.

    STEPS:

    1. Configure the webhook for your jenkins instance in the Webhook section of the github Repository, the Payload URl will look similar to,

      http://jenkinsinstance:8080/github-webhook/

    2. In the Jenkins Job configuration just enable, GitHub hook trigger for GITScm polling

    3. Then in the SCM section add the below configuration available in the image, assuming the branch you want to build being the Hotfix branch. The Below image defines the exact configuration of SCM section.

    SCM Configuartion image

    1. Once done, try to commit code changes to the Hotfix branch, which in return should trigger the jenkins job.

提交回复
热议问题