Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33865

Double Build on Multibranch Pipeline with open PR

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • Jenkins v1.652 running on a Ubuntu 14.04

      The multi pipeline plugin is great, but there is one annoying thing that prevents me from actively using it:

      I have a BitBucket Git Repository where I experimentally created feature branches containing a Jenkinsfile with build instructions - it works very well. Whenever I push to the branch, the BitBucket hooks are set up and work, they trigger a new indexing - so far, so good.

      However, if I now open a PR for that branch (which is quite standard), then indexing will do the following:

      Finds the branch -> matches criteria
      Finds the PR -> of course, matches criteria too (that is, it contains a Jenkinsfile, as opposed to other branches)

      This results in everything being doubled: The build itself, along with all notifications, build messages... This is quite a waste of resources as one build takes around 8 Minutes. Also, the doubled builds interfere because they are unfortunately using the same MySql Database.

      Am I missing something here? The Doc says that the indexing scans for open branches and PRs, so this is not a bug. However, this will very often result in the behavior I just described. How can I prevent Jenkins from doubling everything? I would really like to start using this as it is much more clear than the old pipeline currently in place ...

      I would suggest either to give an option to disable scanning for PRs, or make the indexing smart enough to see that the branch for a PR was already scheduled - which would be what I'd prefer.

          [JENKINS-33865] Double Build on Multibranch Pipeline with open PR

          Jesse Glick added a comment -

          github-branch-source automatically skips PRs filed from origin branches. I do not know enough about BitBucket to be sure that this is making the analogous request.

          Jesse Glick added a comment - github-branch-source automatically skips PRs filed from origin branches. I do not know enough about BitBucket to be sure that this is making the analogous request.

          Nenad Miksa added a comment -

          If JENKINS-34931 is fixed, then this will not be same anymore - the push would build feature branch HEAD, and pull request build would build merge commit.

          Nenad Miksa added a comment - If JENKINS-34931 is fixed, then this will not be same anymore - the push would build feature branch HEAD, and pull request build would build merge commit.

          Added an option to skip pull requests to prevent double builds.

          The pull request is available on Github

          Sergey Zhemzhitsky added a comment - Added an option to skip pull requests to prevent double builds. The pull request is available on Github

            amuniz Antonio Muñiz
            lmanzke Lucas Manzke
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: