I did everything as told and got some experiences:

  1. Webhooks are not working (Jenkins ver. 2.164.3 and Bitbucket cloud). Instead, I had to rely on periodic ‘Scan Multibranch Pipeline Triggers’.
  2. Jenkins builds for PRs can be made using the wrong commits.

The second one comes as a real surprise!

I have the branch jenkins-test-3 forked from master and jenkins-test-4 forked from master.

Before pull-request from jenkins-test-4 to jenkins-test-3 there were commits:

  • c013c79... — the last commit in jenkins-test-3.
  • dc05341... — the last commit in jenkins-test-4 made in master after jenkins-test-3 was forked, but before jenkins-test-4.

Pull request from jenkins-test-4 to jenkins-test-3 made its own commit 95a42f5.... In Bitbucket UI we see the build is passed in CI, but what is in Jenkins log:

Branch indexing

Loading trusted files from base branch jenkins-test-3 at c013c792c09f81b7a178c0fa77343e65e3c02871 rather than 95a42f534118ee8584ab34ef0dd6195f6078e6ee
....

And yes, it really built c013c79... for that PR.

It’s Bitbucket Branch Source Plugin who manage to get a source code from the repository and choose which one to build.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s