Search code examples
gitgithubjenkinsjenkins-plugins

Trigger build only on pushes to master


I am using Jenkins with the Github Plugin I have integrated it using GitHub's webhooks and it works like a charm, except that builds get triggered everytime something is pushed to the repository.

Is there a way to limit builds only when a change to the remote branch master has been made?


Solution

  • Action Plan

    • Open the Jenkins job Configuration
    • Go to the section Source Code Managment
    • In the Git section
      • For the field Branches to build add the value */master

    This tells this Jenkins Job, to only execute the job, when something is pushed to the branch master.

    Figure: Shows the configuration, for building only branch master.

    enter image description here