Status: Open (View Workflow)
git version 2.30.2
bitbucket plugin 1.11.1
Jenkins triggers builds of jobs even though the merge into Bitbucket does not include any files that are in the Included Regions values for the Jenkins jobs. This happens often. It might be a coincidence but the most recent time when this happened the jobs that triggered incorrectly were the jobs that had most recently triggered. So
Saturday 19 Feb - Merge commit X into master
Jenkins triggers jobs A,B,C,D - correct
Tuesday 22 Feb - Merge commit Y into master
Jenkins triggers jobs A,B,C,D but these jobs should not have triggered because commit Y does not change any files in the Included Regions values of jobs A,B,C,D.
Checked the Bitbucket webhook Request and it looks correct. It does include
"fromHash": "X", "toHash": "Y"
Is Jenkins maybe triggering the jobs again based upon the "fromHash"?
Unfortunately I cannot share logs or webhook body/headers from our systems. I will attempt to reproduce this on a test environment.
>are calling hasChanges(), if it detects changes, we run build.
There are changes in the merge but the changes are not in the Included Regions so the build should not happen. I am not a Java developer but I will see can I get one of our devs to look at hasChanges(). I think I need to understand how hasChanges() decides if there have been changes.
We are using https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin. I think haschanges() is called in Bitbucket plugin https://github.com/jenkinsci/bitbucket-plugin.
We have Bitbucket plugin installed in Jenkins but I understood it is superceded by Bitbucket server integration plugin.
fame as you can see from https://github.com/jenkinsci/bitbucket-plugin/blob/1492ad6ecc3de53b51f811bb16e83d6ac76c4809/src/main/java/com/cloudbees/jenkins/plugins/BitBucketTriggerRunnable.java#L46, we are calling hasChanges(), if it detects changes, we run build.
Can you please provide more logs or the webhook body/headers?