Hi,
I am running into an issues when I try to automate the process of analyzing newly created solutions (c#) in the following setup:
Git repository in AzureDevOps
Yaml pipeline in AzureDevOps, which uses the SonarCloud tasks to analyze/publish to SonarCloud
SonarCloud license that allows us to use branching
ScannerMode: MSBuild
The Git repository is structured with:
A master branch (which is marked as default),
A feature branch where a team work together on.
Each person creates a pull request branch do their changes and send a PR into the feature branch.
Lets say a new solution needs to be created, then I would do that as a PR. However the standard SonarCloud tasks in AzureDevOps will not allow the pipeline to automatic create a project in SonarCloud, it gives the error that it cannot find the default branch.
As a work-a-round to this I have created a powershell script which is part of the pipeline that ensures the project is created using the RestApi, then I can analyze the PR before pushing to the feature branch.
The problem here is that I need access to the token which the ServiceConnection from AzureDevOps to SonarCloud uses. So I have to have that token in 2 locations, in the service connection and in the pipeline.
Is the process not meant to be automated or am I missing something?
If the new solution is created on the ‘default’ branch, then it works out-of-the box, the project is created in SonarCloud.
Thank you
Mikkel