• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None

      I want to trigger build if someone commit in Bitbuket's specific branch. Current...
      I want to trigger build if someone commit in Bitbuket's specific branch. Currently we can mention which branch to build but on setting remote triggers it trigger build on code commit in any branch not only in given branch.
      I set Jenkins hook as well as post receive hook which triggers build remotely but by giving branch name it give error that no git repo or branch is set.

      http://server/jenkins/git/notifyCommit?url=git@bitbucket.org:myrepogit[&branches=dev]
      Gives Response:
      No git jobs using repository: git@bitbucket.org:myrepo,git[ and branches: dev]
      No Git consumers using SCM API plugin for: git@bitbucket.org:myrepo.git[

      http://jenkins/git/notifyCommit?url=https://bitbucket.org/myrepo
      works fine and triggers build but as soon as I mention branch in url like:
      http://server/jenkins/git/notifyCommit?url=git@bitbucket.org:myrepogit[&branches=dev] 

      No git jobs using repository: git@bitbucket.org:myrepo,git[ and branches: dev]
      No Git consumers using SCM API plugin for: git@bitbucket.org:myrepo.git[

          [JENKINS-26482] Git trigger build on push in any branch

          Mark Waite added a comment -

          Have you tried using the "branches to build" field to limit the branches which can be built by the job?

          Can you upload the config.xml file for that job so that the precise definition of the job is available?

          Mark Waite added a comment - Have you tried using the "branches to build" field to limit the branches which can be built by the job? Can you upload the config.xml file for that job so that the precise definition of the job is available?

          Same problem here, attaching a screenshot of our job configuration. Jenkins 1.602, git-plugin 2.3.4, builds get triggered from GitLab web hook.

          The build shown in the screenshot triggers when any change on any branch gets pushed.

          Specifying branch name in the notifyCommit url (if it would work) is not an option since we want to have builds for all branches (using the jenkins-build-per-branches "plugin").

          Is there a way to solve this through configuration?

          Stefan Thurnherr added a comment - Same problem here, attaching a screenshot of our job configuration. Jenkins 1.602, git-plugin 2.3.4, builds get triggered from GitLab web hook. The build shown in the screenshot triggers when any change on any branch gets pushed. Specifying branch name in the notifyCommit url (if it would work) is not an option since we want to have builds for all branches (using the jenkins-build-per-branches "plugin"). Is there a way to solve this through configuration?

          Mark Waite added a comment -

          I'm not aware of any way to solve this through configuration.

          Mark Waite added a comment - I'm not aware of any way to solve this through configuration.

          Stefan Thurnherr added a comment - - edited

          Turned out that there is a plugin for this (if using GitLab): https://wiki.jenkins-ci.org/display/JENKINS/Gitlab+Hook+Plugin
          The notify_commit web hook works like a charm for us: only builds with matching "Branch Specifier" get triggered after a git push.

          Stefan Thurnherr added a comment - - edited Turned out that there is a plugin for this (if using GitLab): https://wiki.jenkins-ci.org/display/JENKINS/Gitlab+Hook+Plugin The notify_commit web hook works like a charm for us: only builds with matching "Branch Specifier" get triggered after a git push.

          same problem here. it is not possible to use hook, if the default-branch isn´t defined as poll option in jenkins.

          Niko Madalinski added a comment - same problem here. it is not possible to use hook, if the default-branch isn´t defined as poll option in jenkins.

            Unassigned Unassigned
            faisalalirabbani Faisal Rabbani
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: