Skip to content
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

Avoid administrative API for edition check when possible #946

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

raspy
Copy link
Contributor

@raspy raspy commented Feb 26, 2024

Some tools, like sonar-measures-export, might be able to run with a non-administrative user, provided that project keys are specified and the user has access to those projects. However, at the very early stage, the script checks for SonarQube server edition to identify whether branches are supported or not. This check is being done in two different approaches:

  • with navigation/global, available for all users, or
  • with system/info, available for administrators only.

Currently the choice of the API is hardcoded based on server version; servers below 9.7.0 will go the administrative path and therefore the scripts will not work for non-administrators. SONAR-10718 suggests however that the necessary information is available in versions as low as 7.2. This pull requests changes the logic to first inspect the non-administrative API for edition check and fall back to administrative API only when the information is not available in non-administrative API. This avoids hardcoding server versions and allows non-administrators to use the scripts on servers <9.7.0.

@okorach-sonar
Copy link
Contributor

Thank you for the detailed and clear explanation that you suggest, and the PR @raspy.
All good for me, I'll merge and release in a couple of days or weeks (I'll wait to see if any other change is popping before releasing 2.9).

@okorach okorach merged commit 6fcef55 into okorach:master Mar 4, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants