We require at least one successful build before a PR can be merged. When the PR is created it immediately recognizes the build for the feature branch, which doesn't do anything, so it completes successfully very fast. But it takes a little bit of time for the PR build to kick off. Which allows enough time for someone to merge the PR before the PR build has actually completed. We use Jenkins for our build pipeline.
How can I help avoid merges before the PR build has successfully completed?
Yes, that is the whole problem. The commit is on a feature branch and a PR branch. The feature branch does not do anything at finishes successfully, before the PR branch runs the tests and fails. So the PR can be merged before the PR branch build finishes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure if understood your scenario correctly from your description, but wouldn't setting minimum builds to 2 achieve what you want?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Saxea _Flowie_ , I was nervous about setting the minimum build to 2, incase the feature branch was not picked up for some reason, because it is only an issue sometimes, not every time. But I think you are correct, setting the minimum build to 2 should resolve the problem.
I also found another solution, where I can update the Jira plugin configuration. Right now we are using a global configuration in the Jira plugin to report the build status for all stages with the name "build". I can disable this global configuration and update the pipelines to report the status only when certain criteria is met.
Thank you very much for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The issue you’re running into is that Jenkins is reporting the branch build as successful right away, so GitHub (or your SCM) thinks the required check has already passed, even though the actual PR build hasn’t finished. The way around this is to separate the two builds so that only the PR build posts the status that’s marked as required for merging. In Jenkins, you can configure the job or pipeline that runs on pull requests to post its own distinct status, something like “Jenkins PR Build,” instead of reusing the branch build status. Then in your repository settings, you set that PR-specific status as the required check before merging. That way, the merge button won’t unlock until the PR build is done, and the quick branch build won’t cause false positives. If you’re using the GitHub plugin or multibranch pipelines, make sure the PR event triggers and reports correctly so Jenkins is always validating the merge commit, not just the branch head. https://dhcmenu.com/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We use Bitbucket Cloud and the Bitbucket branch plugin for Jenkins.
Where do I set the the "PR-specific status as the required check before merging" in Bitbucket Cloud?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.