How to migrate SonarCloud projects

Version: Sonar Cloud
Code Repository: Azure Repos Git
Integration: Azure DevOps Services

We have recently migrated our Azure Git repository from project A to project B under the same organization in Azure DevOps. There is no documentation/steps explained about migrating the sonarcloud project if there is change in the source code repository of the azure devops project.

Note: Both projects are under same organization in Azure Devops

Old Repo: https://dev.azure.com/orgName/**ProjectA**/_git/samplerepo
New Repo: https://dev.azure.com/orgName/**ProjectB**/_git/samplerepo

Could you please assist how to refer the new azure devops project reference in the existing project in Sonarcloud by updating the project key or do we need to be import as new project?

Hi,

If you want to keep your history, then I believe you only need to make sure your ProjectB analysis uses the sonar.projectKey that used to belong to ProjectA.

If you don’t care about the history, then you can just delete ProjectA and import ProjectB.

 
HTH,
Ann

Hi Ann,

Thanks for your reply.
As you suggested I have updated the Project B project key to refer the project A but now I am getting the below error. Could you please assist on it.

ERROR: Could not find a default branch to fall back on.

Hi,

Could you provide the full analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

Hi Ann,

I have uploaded the Logs please check and let me know if you need further details.

Logs.txt (37.0 KB)

Hi,

It looks like the problem starts well before the error:

2023-04-11T12:21:25.6390341Z 12:21:25.638 INFO: Load project settings for component key: 'OrganisationName_dtfa-pipelib'
2023-04-11T12:21:25.7065974Z 12:21:25.706 DEBUG: GET 404 https://sonarcloud.io/api/settings/values.protobuf?component=OrganisationName_dtfa-pipelib | time=67ms

So either the project doesn’t exist or the credentials you’re using don’t have access to it.

 
HTH,
Ann