-
-
Notifications
You must be signed in to change notification settings - Fork 571
feature: Make bitbucket build-status optional #1168
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
base: master
Are you sure you want to change the base?
feature: Make bitbucket build-status optional #1168
Conversation
|
|
||
| BuildStatus buildStatus = new BuildStatus(analysisDetails.getQualityGateStatus() == QualityGate.Status.OK ? BuildStatus.State.SUCCESSFUL : BuildStatus.State.FAILED, reportKey, "SonarQube", analysisSummary.getDashboardUrl()); | ||
| client.submitBuildStatus(analysisDetails.getCommitSha(),buildStatus); | ||
| if (!"true".equalsIgnoreCase(System.getenv("SONAR_BITBUCKET_SKIP_BUILD_STATUS"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't something that appears to exist in Sonarqube's documentation, so we're diverging from how they're configured. Do they have a property they offer for allowing a similar configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, The Sonarqube's documentation don't mention submitting any build status, only code insight.
https://docs.sonarsource.com/sonarqube-server/10.7/devops-platform-integration/bitbucket-integration/bitbucket-server-integration#preventing-pull-request-merges-when-the-quality-gate-fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some digging, I found that the feature of blocking a PR from code insight was released in the version 6.9 of Bitbucket.
If I do an additional http call to get the version of bitbucket, and based on that version only submitting a build-status if it's lower than 6.9 ?
The initial issue don't mention any bitbucket version at all.
|
I agree on the sentiment that the native 'Code Insights' mechanism should be used to indicate the status of a quality gate and whether it should block merging. This isn't in line with other ALM integrations, but is in line with the official SonarQube documentation, as @ThibautMarechal pointed out. Well, at least for the Server edition of Bitbucket. As it turns out the behavior is different between the Server edition and the Cloud edition. Bitbucket Server uses Code Insights, Bitbucket Cloud uses failed builds. I assume the reporter of #893 was using the Cloud edition of Bitbucket. One could argue #998 introduced a regression for all Bitbucket Server users. I propose implementing the quality gate handling depending on the actual ALM type. There is Furthermore I suggest using "Code Insights" exclusively and not using failed builds at all for What do you think? |
…ariables" This reverts commit 171ad0f.
bd64edd to
5abcdd7
Compare
|
Good idea it may help to workaround my issue: #1171 |
|
+1 Thanks for implementing this, 100% support making SQ -> BB build-status optional. So, quite the hassle, would be nice having this disabled for BB server (or configurable) on the SQ side to remove the workarounds and have the old behavior back. |
Hi,
This change adds the ability to skip the build-status publishing that currently blocks pull-request merges. The functionality is redundant when using Bitbucket’s native feature to block pull-requests based on a Code Insight condition (see screenshot below).

This PR addresses the following issue: #1097.
I’m not a Java developer, so there may be a more elegant way to implement this. I also didn’t find any existing configuration in the repository that I could replicate for this functionality.
Any guidance or suggestions for improvement would be greatly appreciated.