The tutorial to configure a new project using CircleCI redommends using a context named SonarCloud and its environment variables.
If there are more than one projects using SonarCloud in one organization with different people managing them, this can lead to the user not being authorized to push analyzis results to SonarCloud. This is due to CircleCI preferring the contect environment variables over the project environment variables.
I ran into this problem in the following scenario: PersonA and PersonB are part of the same organization in CircleCI and in SonarCloud. PersonA has already configured a project using both CircleCI and SonarCloud following the tutorial. PersonB wants to configure a new project. PersonA has no access to this new project, so they can’t execute an analysis for it. PersonB can’t create a new context named SonarCloud. PersonB has to use project environment variables and they have to remove the usage of the context in the config.yml.
In my opinion, this is misleading and it took me (a complete newbie to Sonar* and CircleCI) more than a day to find the solution. Is it possible to update the tutorial so it recommends the usage of project environment variables?
I get the added value of using the context variables so you don’t have to configure the same variable in multiple projects but I think recommending the project variables makes it easier to understand. Maybe the possibility of using context variables could be added as a hint like “You manage more than one project in your organization? Take a look at using context variables instead of project variables. [link to docs]”