SonarQube communti Edition API, Branch key still working

  • versions used (SonarQube community edition 8.5.1)
  • error observed (example api/hotspots/search Branch key, not availble in community edition, but still working)
  • steps to reproduce ( curl https:// api/hotspots/search?projectKey=xxxx&branch=develop) and we gonna have a susccessful call

why the branch key in Sonarqube API call is still working even if it mentionned that is not available in community edition ? is this really a bug or im missing something ?

Hi,

Welcome to the community!

First, your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.5.1 → 8.9.6 → 9.3 (last step optional)

You may find the Upgrade Guide helpful. If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your question, are you sure the branch key is doing something? Do you get a different response with it, versus without it?

 
HTH,
Ann

Hello, thank you for your answer.
yes, i’m getting different response, for example i’m sure that in the master branch we got 12 hotspots and in the develop barnch we got 23 hotspots, and this is the exact numbers i get when passing branch parameter.in the api call

it is a bug isn’t ?

Hi,

If you’re in Community Edition, how do you have multiple branches in your project?

But also, we don’t filter the APIs based on edition. It’s easier for us and gives you a full view of the data you could get.

 
Ann

i passe the Sonar.branch.name value in my jenkins pipline, so i think thaht why i got the multiple branch in my project.

Hi,

I would expect sonar.branch.name to either error-out in analysis or just be ignored.

 
Ann

I’m also experiencing this issue. We are using Enterprise Edition, Version 9.3 (build 51899). I’m able to successfully download the PDF for master branch, but when specifying branchKey (based on the documentation) I still get the master branch. I have tried to use branch=xyz with no difference. my cUrl statement is: curl -k -u $SONARQUBE_TOKEN: myUrlHere/api/governance_reports/download?componentKey=myProjectName&branchKey=myBranchName --output ~/temp.pdf

Is the branchKey parameter incorrect?

Thanks in advance

Hi,

Welcome to the community!

Have you tried this via the UI? The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action.

 
HTH,
Ann

Hi Ann. To be honest, I don’t see a way to export through the Web Interface to export to PDF, perhaps I am overlooking something.

Ok, so I see there is an export to PDF button when in the project dashboard and on branch master. If I switch to a different branch, the button is no longer there.

Is it possible to export to PDF either through the API or Manually for a particular branch / Merge Request?

Hi,

The button should be there for each “branch”, but no you won’t see it for PRs.

 
Ann

It’s the same issue then. When I hit the drop down to change branches, I do see several options, but only 1 (master) has the little branch icon next to it, the others are under the Pull Request header with the PR icon. How do I get SQ to recognize a branch other than master?
is there a particular naming scheme the software is looking for? like feature/xyz?

I have also opened this post, which is detailing more of the same issue:

Hi,

The docs should help.

 
Ann