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

Bitbucket-branch-source Plugin notifies library repository, not project repository

    Details

    • Similar Issues:

      Description

      I was wondering to get totally unrelated build status notifications in our "base-jenkins-lib" global CPS library repository.

      Turned out that when the actual project's ("example-hello-world") job was run (which uses the "base-jenkins-lib" library) the notifications ended up in last Bitbucket commit for the library, not in the commit for the project.

      Also note that it ended up exclusively in the commit of the library, no status was reported to the project's commit.

      I guess it just takes the wrong SHA as two git sources are present when you use a global library:

      Started by user admin
      > git rev-parse --is-inside-work-tree # timeout=10
      Setting origin to ssh://git@stash.intranet.acme.com:7999/devops/example-hello-world.git
      > git config remote.origin.url ssh://git@stash.intranet.acme.com:7999/devops/example-hello-world.git # timeout=10
      Fetching origin...
      Fetching upstream changes from origin
      > git --version # timeout=10
      > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
      Seen branch in repository origin/feature/do-try-improved
      Seen branch in repository origin/feature/sonarqube
      Seen branch in repository origin/feature/xxx
      Seen branch in repository origin/master
      Seen 4 remote branches
      Obtained Jenkinsfile from 5dce620f781e59afb1e960aa6a8e32a1e0cf83b8
      Loading library base-jenkins-lib@feature/do-try-improved
      > git rev-parse --is-inside-work-tree # timeout=10
      Setting origin to ssh://git@stash.intranet.acme.com:7999/devops/base-jenkins-lib.git
      > git config remote.origin.url ssh://git@stash.intranet.acme.com:7999/devops/base-jenkins-lib.git # timeout=10
      Fetching origin...
      Fetching upstream changes from origin
      > git --version # timeout=10
      > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
      > git rev-parse feature/do-try-improved^{commit} # timeout=10
      > git rev-parse origin/feature/do-try-improved^{commit} # timeout=10
      > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
      > git config remote.origin.url ssh://git@stash.intranet.acme.com:7999/devops/base-jenkins-lib.git # timeout=10
      Fetching upstream changes from ssh://git@stash.intranet.acme.com:7999/devops/base-jenkins-lib.git
      > git --version # timeout=10
      > git fetch --tags --progress ssh://git@stash.intranet.acme.com:7999/devops/base-jenkins-lib.git +refs/heads/*:refs/remotes/origin/*
      Checking out Revision 43a8bcec5d1eb28df07b736a2fb82e08960a6121 (feature/do-try-improved)
      > git config core.sparsecheckout # timeout=10
      > git checkout -f 43a8bcec5d1eb28df07b736a2fb82e08960a6121
      > git rev-list 43a8bcec5d1eb28df07b736a2fb82e08960a6121 # timeout=10
      [Bitbucket] Notifying commit build result
      [Pipeline] node
      Running on master in /var/lib/jenkins/workspace/-ci_feature_do-try-improved-6ALO3R3UJUUQTAP75WY5TGJTIY6TWKBVT2CR5G527CQ2OFRJ73UQ
      [Pipeline] {
      [Pipeline] echo
      ...

       

       

       

        Attachments

          Issue Links

            Activity

            Hide
            tknerr Torben Knerr added a comment -

            Set priority to "critical" because notifications are the whole point of this plugin (for us at least)

            Show
            tknerr Torben Knerr added a comment - Set priority to "critical" because notifications are the whole point of this plugin (for us at least)
            Hide
            tknerr Torben Knerr added a comment -

            Is probably related to JENKINS-41214, but we are not using a custom recognizer, so I'm not sure you consider this a duplicate

            Show
            tknerr Torben Knerr added a comment - Is probably related to JENKINS-41214 , but we are not using a custom recognizer, so I'm not sure you consider this a duplicate
            Hide
            tknerr Torben Knerr added a comment -

            Attached the job config.xml for inspection. You won't find the "base-jenkins-lib" repo mentioned here, because we set it to "Load implicitly" for every pipeline job via the global Jenkins configuration 

            Show
            tknerr Torben Knerr added a comment - Attached the job config.xml for inspection. You won't find the "base-jenkins-lib" repo mentioned here, because we set it to "Load implicitly" for every pipeline job via the global Jenkins configuration 
            Hide
            mkobit Mike Kobit added a comment -

            I also reported this in https://issues.jenkins-ci.org/browse/JENKINS-41996 . I goto pretty deep into this and I'm fairly certain that I found the culprit in the code but I am unable to figure out the right way to implement a fix. I was asking for some help but still haven't received anything. Hopefully somebody can take them off from here and move it forward.

            Show
            mkobit Mike Kobit added a comment - I also reported this in  https://issues.jenkins-ci.org/browse/JENKINS-41996 . I goto pretty deep into this and I'm fairly certain that I found the culprit in the code but I am unable to figure out the right way to implement a fix. I was asking for some help but still haven't received anything. Hopefully somebody can take them off from here and move it forward.
            Hide
            hogarthj James Hogarth added a comment -

            We've just introduced global shared libraries for common functionality implicitly loaded into our workplace.

            Today we were accidentally triggering everyone's jobs and our commits where confusingly appearing on their pages as details changed.

            This pretty much wrecks much shared library utility 

            Show
            hogarthj James Hogarth added a comment - We've just introduced global shared libraries for common functionality implicitly loaded into our workplace. Today we were accidentally triggering everyone's jobs and our commits where confusingly appearing on their pages as details changed. This pretty much wrecks much shared library utility 
            Hide
            hogarthj James Hogarth added a comment -

            To be clear on our config, there is no "custom recogniser"

            It is a vanilla shared global library, implicitly loaded, using "Modern SCM git" as the option for the source just looking at the master branch as per the examples here:

            https://jenkins.io/doc/book/pipeline/shared-libraries/

            Show
            hogarthj James Hogarth added a comment - To be clear on our config, there is no "custom recogniser" It is a vanilla shared global library, implicitly loaded, using "Modern SCM git" as the option for the source just looking at the master branch as per the examples here: https://jenkins.io/doc/book/pipeline/shared-libraries/
            Hide
            hogarthj James Hogarth added a comment -

            Actually I realise that I'm talking the inverse of this problem, not commits to a project appearing in a shared library, but rather commits to a shared library appearing in a project and triggering builds there ... which this bug more accurately reflects

            https://issues.jenkins-ci.org/browse/JENKINS-41497

            Show
            hogarthj James Hogarth added a comment - Actually I realise that I'm talking the inverse of this problem, not commits to a project appearing in a shared library, but rather commits to a shared library appearing in a project and triggering builds there ... which this bug more accurately reflects https://issues.jenkins-ci.org/browse/JENKINS-41497

              People

              • Assignee:
                amuniz Antonio Muñiz
                Reporter:
                tknerr Torben Knerr
              • Votes:
                7 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: