which versions are you using (SonarQube 9.9.0, 9.9.2 Enterprise)
how is SonarQube deployed: Docker
what are you trying to achieve
Attempting to auto-provision repository details for projects missing DevOps integration
what have you tried so far to achieve this
Used curl to hit Sonarqube API to obtain alm_integrations; results are useless (0 results returned) for API: api/alm_integrations/list_github_repositories?internal=true&almSetting=github
and 0 organizations returned for API call: api/alm_integrations/list_github_organizations?internal=true&almSetting=github Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
I made some attempts based on the suggestion, when I made the request for 'api/alm_integrations/list_github_repositories?internal=true&almSetting=github' including some additional parameters as revealed by the examples, the result came back as {"errors":[{"msg":"No personal access token found"}]}
Any further suggestions?
You’ll need to make the requests with a user that has configured a PAT for project creation in the SonarQube UI, or with after setting it with POST api/alm_integrations/set_pat
Ah, okay, I understand. I was mixing up how some of the other DevOps Platforms integrate with SonarQube. Sorry about that.
For Github, SonarQube is communicating with GitHub to retrieve an application access token which is provided to the token query parameter when the call is being made from SonarQube.
Since SonarQube itself is negotiating this temporary application access token, I don’t think you’ll be able to mimic this behavior outside of SonarQube just using API calls, although maybe you can do something with these APIs.
Going back to your original use-case:
Is the goal here to fill in this data for existing projects?
@Colin,
No, the goal is to provision new, previously un-analyzed projects. Typically, a branch is created on an existing repository to add Sonarqube analysis, so main/master is NEVER analyzed initially. Unless, of course, a project has been analyzed already, but is missing the integration details (very common use-case for us.)