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

后端 未结 4 389
滥情空心
滥情空心 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-17 00:03

    To have different Jenkis projects for different branches I did the following:

    • Install Bitbucket Plugin at your Jenkins
    • Add a normal Post as Hook to your Bitbucket repository (Settings -> Hooks) and use following url:

    https://YOUR.JENKINS.SERVER:PORT/bitbucket-hook

    • Configure your Jenkins project as follows:
      • under build trigger enable Build when a change is pushed to BitBucket
      • under Source Code Management select GIT; enter your credentials and define Branches to build (like **feature/*) <- this is where you define different branches for each project

    By this way I have three build projects, one for all features, one for develop and one for release branch.

    And best of it, you don't have to ad new hooks for new Jenkins projects.

提交回复
热议问题