We have a repo in BitBucket Server with "Minimum successful builds" merge check enabled and set to 1. When PR is opened the build starts and result of that build returns back to BitBucket. Sometimes build fails (out of memory, etc) we run build again manually (without new commits). In that case PR contains two builds: first is "Failed" and the second is "Passed", but "Minimum successful builds" merge check still can't allow us to merge because it require to all builds be successful. It is possible to check only last build be successful to allow PR merge?
BitBucket merge check to allow merge PR when ONLY LAST build is successful
Asked Answered
Still looking for answer for this too –
Provocation
I just noticed that I usually don't have this problem except after pushing a sub-branch of, or a tag on the source branch of the PR. This is what seems to confuse the "Minimum successful builds" check. –
Glory
So, the only solution I've found so far is changing the build name which Jenkins sends to Bitbucket. The main idea is that the build name must always be the same for that particular Pull Request. In that case, PR build name on Bitbucket is overridden each time when a new build of the PR starts by Jenkins.
In our case, I just removed Jenkins's BUILD_NUMBER from the build name, which it sent to Bitbucket.
The only drawback of that solution I've found is that you can only see last build status of the PR without any build history.
© 2022 - 2024 — McMap. All rights reserved.