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

Jenkins spawns two builds (for two branches) after notifyCommit detects changes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins: v2.105
      GIT plugin: v4.0.0-beta2
      GIT client plugin: v3.0.0-beta3

      Hello.

      My setup contains multibranch pipeline project driven by Jenkins (declarative) file.

      Jenkinsfile fraction:

      triggers {
          pollSCM('')
      }
      

      And I start Jenkins with:

      -Dhudson.plugins.git.GitStatus.safeParameters=pullRequestId,toBranch,toHash,mergeCommit,fromHash,action,author,reviewers
      

      Once new commit is detected on my Bitbucket server, Pull Request Notifier for Bitbucket plugin sends notifyCommit request to the Jenkins. notifyCommit request contains both, sha1 and branches parameters. SHA1=5c5e0c03cbab1dae0dcb9f755689ac1cfca653c9 and branches=feature/jen3.

      However, Jenkins spawns two builds from this very request (#101 and #102):

      Event log (notice that "Processed 2 branches"):

      [Mon Jun 11 13:08:41 CEST 2018] Received jenkins.plugins.git.GitSCMSource$ListenerImpl$1 UPDATED event from 10.29.1.239 ⇒ https://***/git/notifyCommit with timestamp Mon Jun 11 13:08:41 CEST 2018
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh rev-parse --is-inside-work-tree # timeout=10
      Setting origin to ssh://git@***:7999/jen/jenkins.git
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh config remote.origin.url ssh://git@***:7999/jen/jenkins.git # timeout=10
      Fetching & pruning origin...
      Fetching upstream changes from origin
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh --version # timeout=10
      using GIT_SSH to set credentials 
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune
      Listing remote references...
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh config --get remote.origin.url # timeout=10
      using GIT_SSH to set credentials 
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh ls-remote -h ssh://git@***:7999/jen/jenkins.git # timeout=10
      Checking branches...
        Checking branch feature/jen3
            ‘Jenkinsfile’ found
          Met criteria
      Changes detected: feature/jen3 (0e8de89af3183f9f6daac7bd9e40203a0465799d → 5c5e0c03cbab1dae0dcb9f755689ac1cfca653c9)
      Scheduled build for branch: feature/jen3
      Processed 2 branches (query complete)
      [Mon Jun 11 13:08:42 CEST 2018] jenkins.plugins.git.GitSCMSource$ListenerImpl$1 UPDATED event from 10.29.1.239 ⇒ https://***/git/notifyCommit with timestamp Mon Jun 11 13:08:41 CEST 2018 processed in 1 sec

       

      notifyCommit request contains additional parameters and the exclamation mark means that build #101 has been spawned without the parameters provided (have when clause inside stages).

       

      Build #101:

      See the branch name "feature/jen3"

       

       

      Build #102:

      Branch name is different "origin/feature/jen3"

       

      Build #103:

      Was also triggered by notifyCommit, but with manual trigger by clicking a button (supported by the Bitbucket plugin) while no new changes has been made to the repository.

       

       

      1. Is that normal behavior that Jankins is processing two branches (even though they are the same, aren't they?) or is it a bug?

       

      Thank you.

       

        1. image-2018-06-12-08-37-43-767.png
          image-2018-06-12-08-37-43-767.png
          28 kB
        2. image-2018-06-12-08-39-21-145.png
          image-2018-06-12-08-39-21-145.png
          30 kB
        3. jenkins-101.png
          jenkins-101.png
          35 kB
        4. jenkins-102.png
          jenkins-102.png
          31 kB
        5. jenkins-103.png
          jenkins-103.png
          30 kB

            Unassigned Unassigned
            ferda_mravenec Ferda Mravenec
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: