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

Change in SharedLibrary triggers jobs that are using the ShareLibrary

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins LTS 2.346.1
      Bitbucket Push and Pull Request Plugin 2.8.1
      Bitbucket Server 7.17.3

      Hello,

      we have the scenario, that we are using a Shared Library which is stored in Bitbucket.
      This SharedLibrary is used by some jobs.

      System Environment:

      Jenkins LTS 2.346.1
      Bitbucket Push and Pull Request Plugin 2.8.1
      Bitbucket Server 7.17.3

      Now we have this behaviour:

      -we change something in the Shared Library
      -and create a Pull Request
      This triggers the jobs that are using the Shared Library.

      So for example:
      The job "JT_Bitbucket_PnP_Repo01" starts it's jenkinsfile with "@Library('SharedLibraryGit') _"

      In the log it shows first:

      Aug 23, 2022 9:46:00 AM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRJobProbe
      jt_bitbucket_pnp_repo01_pipeline SCM doesnt match remote repo {1} or it was already triggered.

      But later in the log it shows:

      Aug 23, 2022 9:46:10 AM INFO io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRTrigger scheduleJobTriggering jt_bitbucket_pnp_repo01_pipeline # 20
      Aug 23, 2022 9:46:10 AM INFO io.jenkins.plugins.bitbucketpushandpullrequest.observer.BitBucketPPRObservable notifyObservers
      Event: BitBucketPPRBuildStarted [context=BitBucketPPREventContext scmTrigger=hudson.plugins.git.GitSCM@7428ebc9, run=Test_Project/IT_Test_Use_Cases/jt_bitbucket_pnp_repo01_pipeline [#20, handler=null] for observer io.jenkins.plugins.bitbucketpushandpullrequest.observer.BitBucketPPRPullRequestServerObserver@2918c62

      In the Job it behaves like this:

      It doesn't build the SharedLibrary then in that job, but it just runs the normal Jenkinsfile from the Job

      Bitbucket variables are:
      11:28:40 BITBUCKET_PAYLOAD={"actor":{"name":"BujorL","emailAddress":"Liviu.Bujor@{_}","id":"2658","displayName":"Bujor, Liviu (SDSS-SI)","active":true,"slug":"bujorl","type":"NORMAL","links":{"clone":[],"self":[{"href":"https://{_}{_}/users/bujorl"}]}},"pullRequest":{"id":23,"version":23,"title":"update jenkins architecture to build main stream and down stream job","state":"OPEN","open":true,"closed":false,"createdDate":1660318588083,"updatedDate":1661246896031,"locked":false,"author":

      {"active":false}

      ,"reviewers":[\{"active":false},\{"active":false},\{"active":false},\{"active":false},\{"active":false},\{"active":false},\{"active":false}],"participants":[],"links":{"clone":[],"self":[{"href":"https://{_}{_}/projects/ITJENKSL/repos/sharedlibrary/pull-requests/23"}]},"fromRef":{"id":"refs/heads/feature/JENKINS-560-port-shared-library-build-to-jenkt01-test-agent","displayId":"feature/JENKINS-560-port-shared-library-build-to-jenkt01-test-agent","latestCommit":"e5244c739420bdc17bc3fe1a7970fd60b218eafd","repository":{"slug":"sharedlibrary","id":"234","name":"SharedLibrary","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"ITJENKSL","id":"42","name":"Jenkins Shared Library","links":{"clone":[],"self":[{"href":"https://{_}{_}/projects/ITJENKSL"}]},"public":false,"type":"NORMAL"},"links":{"clone":[{"href":"https://{_}{_}/scm/itjenksl/sharedlibrary.git","name":"http"},{"href":"ssh://git@{_}{_}:7999/itjenksl/sharedlibrary.git","name":"ssh"}],"self":[{"href":"https://{_}{_}/projects/ITJENKSL/repos/sharedlibrary/browse"}]},"public":false}},"toRef":{"id":"refs/heads/master","displayId":"master","latestCommit":"1ec0b102ebf9761bd62df247b8756d74e4190e3d","repository":{"slug":"sharedlibrary","id":"234","name":"SharedLibrary","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"ITJENKSL","id":"42","name":"Jenkins Shared Library","links":{"clone":[],"self":[{"href":"https://{_}{_}/projects/ITJENKSL"}]},"public":false,"type":"NORMAL"},"links":{"clone":[{"href":"https://{_}{_}/scm/itjenksl/sharedlibrary.git","name":"http"},{"href":"ssh://git@{_}{_}:7999/itjenksl/sharedlibrary.git","name":"ssh"}],"self":[{"href":"https://{_}{_}/projects/ITJENKSL/repos/sharedlibrary/browse"}]},"public":false}}},"changes":[]}{_}
      11:28:40 BITBUCKET_PULL_REQUEST_ID=23
      11:28:40 BITBUCKET_PULL_REQUEST_LATEST_COMMIT_FROM_SOURCE_BRANCH=e5244c739420bdc17bc3fe1a7970fd60b218eafd
      11:28:40 BITBUCKET_PULL_REQUEST_LATEST_COMMIT_FROM_TARGET_BRANCH=1ec0b102ebf9761bd62df247b8756d74e4190e3d
      11:28:40 BITBUCKET_PULL_REQUEST_LINK=https:///projects/ITJENKSL/repos/sharedlibrary/pull-requests/23
      11:28:40 BITBUCKET_PULL_REQUEST_TITLE=update jenkins architecture to build main stream and down stream job
      11:28:40 BITBUCKET_SOURCE_BRANCH=feature/JENKINS-560-port-shared-library-build-to-jenkt01-test-agent
      11:28:40 BITBUCKET_TARGET_BRANCH=master

      Can you please suggest how we can avoid this?

      Thanks
      Christoph

            cdelmonte Christian Del Monte
            christopha Christoph
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: