Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Sonar Quality gate preventing PR Merge

David Kossatz January 8, 2019

I have a PR created in our BitBucket Server but the Merge is being prevented as shown in the attached screenshot (Open issues: 16 > 0).  I'm trying to figure out where this is configured.

I've attached a screenshot of the Quality Gate we are using for the project and do not see that metric there.  How do we change this?

Using SonarQube v7.4 Developer Edition, Sonar for BitBucket Server plugin v2.3.1, BitBucket Server v5.9.1.

Thanks in advance!

David

 

 

PR Preventing merge.pngQualityGateProfile.png

1 answer

1 accepted

0 votes
Answer accepted
Jennifer Schuch January 8, 2019

We also use Sonar, but this question is for SonarQube, not Atlassian.

David Kossatz January 8, 2019

@Mibex_Software is who I was targeting a response from.  Perhaps I should have opened a ticket from their website though.

Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 9, 2019

Hi @David Kossatz

This pull request merge block message comes from a failed quality gate in Sonar. Could you please double-check that you are looking at the quality gates of the project you analyze (and not at the quality gate of a different project) and if you can find a quality gate with a metric called "Open issues"?

Best regards,
Michael

David Kossatz January 9, 2019

Hi Michael,

I confirmed that the Quality Gate conditions in the screenshot I gave was the one configured to the project.  There are only 2 other quality gates configured (Sonar way + another custom one) and none of the 3 gates have the "Open issues" condition.

I even tried to add the "Open issues" condition to the gate and re-running a sonar scan but is still preventing merge with message: "Sonar failed quality gate: Open issues: XX > 0"

In the repository settings for the Sonar plugin, under the Merge Checks tab, I have "Merge Checks" enabled as well as "Use SonarQube Quality Gates"

David Kossatz January 9, 2019

I enabled DEBUG logging and found:

2019-01-09 11:00:16,793 DEBUG [SONAR-5] c.m.s.s.sonar.DefaultSonarClient SONAR time for calling GET http://localhost/api/measures/component?additionalFields=periods,metrics&metricKeys=alert_status,quality_gate_details&componentKey=com.app:app-parent&branch=feature%2FAAA-3-page-is-broken HTTP/1.1: 18.74947ms
2019-01-09 11:00:16,793 DEBUG [SONAR-5] c.m.s.s.sonar.DefaultSonarClient SONAR: RESPONSE: {"component":{"id":"AWgzbqdSpMojYA-W7l4R","key":"com.app:app-parent","name":"App Parent","qualifier":"TRK","measures":[{"metric":"alert_status","value":"ERROR"},{"metric":"quality_gate_details","value":"{\"level\":\"ERROR\",\"conditions\":[{\"metric\":\"open_issues\",\"op\":\"GT\",\"error\":\"0\",\"actual\":\"1\",\"level\":\"ERROR\"},{\"metric\":\"reopened_issues\",\"op\":\"GT\",\"error\":\"0\",\"actual\":\"0\",\"level\":\"OK\"}],\"ignoredConditions\":false}"}],"branch":"feature/AAA-3-page-is-broken"},"metrics":[{"key":"alert_status","name":"Quality Gate Status","description":"The project status with regard to its quality gate.","domain":"Releasability","type":"LEVEL","higherValuesAreBetter":true,"qualitative":true,"hidden":false,"custom":false},{"key":"quality_gate_details","name":"Quality Gate Details","description":"The project detailed status with regard to its quality gate","domain":"General","type":"DATA","qualitative":false,"hidden":false,"custom":false}],"periods":[]}

So the issue does appear to be on the SonarQube side of things.  I'll post my question there.

Thanks.

 

EDIT:  Appears to be a limitation of short-lived branches in SonarQube.  https://docs.sonarqube.org/latest/branches/short-lived-branches/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events