ALM: Azure Devops
CI: Azure Devops
Scanner integraded with msbuild (netcore apps) (pipeline tasks attached)
We use Azure Devops as our source repository.
Azure devops is organized in team projects.
Due to recently organization changes, we recently created new Team Projects in Azure Devops and some of the repositories are being migrated from old team projects to new ones.
We use the repositoryname as SonarCloud Project Key, So if the repo is migrated with the same name, it should use the same key in SonarCloud.
Sometimes, after the migration we observe the following error when running SonarCloud Analysis in azure devops pipelines after the team project migration:
2023-01-05T17:06:27.9594774Z ##[error]ERROR: Error during SonarScanner execution 2023-01-05T17:06:27.9596572Z ERROR: Error during SonarScanner execution 2023-01-05T17:06:27.9600161Z ##[error]ERROR: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator ERROR: 2023-01-05T17:06:27.9602624Z ERROR: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator 2023-01-05T17:06:27.9603617Z ERROR: 2023-01-05T17:06:28.3235446Z ##[error]The SonarScanner did not complete successfully 2023-01-05T17:06:28.3237981Z The SonarScanner did not complete successfully 2023-01-05T17:06:28.3241882Z ##[error]14:06:28.323 Post-processing failed. Exit code: 1 2023-01-05T17:06:28.3242977Z 14:06:28.323 Post-processing failed. Exit code: 1
The project exists in SonarCloud,
The Azure Devops connection used to connect to SonarCloud is shared among all the projects, so it uses the same user and password.
The user has create and execute analysis permission in SonarCloud
steps to reproduce:
- Create a repo in Azure Devops Team Project 1, run the sonarcloud analysis using reponame as key
- Migrate the repo to Azure Devops Team Project 2, run the sonarcloud analysis using reponame as key.
Remove or rename the sonarcloud project and rerun the pipeline.