Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change in SharedLibrary triggers jobs that are using the ShareLibrary #281

Open
AckermannC opened this issue Aug 23, 2022 · 0 comments
Open

Comments

@AckermannC
Copy link

AckermannC commented Aug 23, 2022

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, action=BitBucketPPRPullRequestServerAction, filter=io.jenkins.plugins.bitbucketpushandpullrequest.filter.pullrequest.server.BitBucketPPRPullRequestServerTriggerFilter@7267d554, userRemoteConfig=+refs/heads/:refs/remotes/origin/ => https:///scm/itjenksl/sharedlibrary.git (origin), url=https:///scm/itjenksl/sharedlibrary.git, trigger=io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRTrigger@24aa7e81], 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant