Hi, thanks for the great product! We use SonarCloud as a hub for all our code-quality metrics and really happy with it.
Currently we’d like to transfer one of repositories from one GitHub organisation to another one and so we’d also like to do the same for the corresponding SonarCloud project (transfer it from one SonarCloud organisation to another).
I’ve found some related topics saying this is not currently possible and we have to recreate the project:
That would be a disaster for us since we’ll lose all the historical data which is valuable for us.
Could you please recommend us a way to resolve that not loosing all the project data?
Some of the similar topics mention that the SonarCloud team can exceptionally change bindings manually. Is that possible in our case?
Is the historical data you’re concerned about the record of the project’s evolution (historic metric values) or issue manipulations (False Positive, Won’t Fix, comments, etc)?
Because the project evolution could be recreated by using the sonar.projectDateanalysis parameter.
Regarding rebinding, I know we no longer rebind organizations. You can vote for adding a rebinding feature here. Altho that feature is about organization rebinding, so you’ll want to be explicit that you’re looking for project rebinding.
Thanks for the info!
Could you clarify some things for me please?
I’d like to save as much as possible. So ideally I’d like to keep both project’s evolution and issue manipulations. I assume you say that saving (or recreating/restoring) the latter is not possible. Is that correct?
Does it mean we’ll have to manually run analysis on every version we’d like to add to the history?
BTW we always specify the sonar.projectVersion parameter, would SonarCloud order analysis runs according to it if don’t specify the sonar.projectDate parameter?
Does it mean there is no way (even manual) to rebind the project? We’re into any possible option.
If that’s not possible what would happen to the SonarCloud project once we transfer our repo to a different GitHub organisation?
It’s not. Not natively. It would be possible to use the APIs to pull a list of FP/WF issues. Then you would have to map them to the issues created in the new clone by file/line number/rule id. From there you could re-FP/WF the clone’s issues, but you’re still going to lose the context of who and when they were initially marked (unless you want to stuff that into an issue comment).
Yes. In order. So checkout the initial commit. Set sonar.projectDate to that value`. Analyze. Increment the date. GoTo 1. Note that housekeeping cleans old analyses out automatically, so you should skip selectively through history.
No. sonar.projectVersion is just a string.
That’s correct. That’s why you want to vote for that feature.
Ehm… I think it would just languish, unanalyzed in SonarCloud. You would probably need to clean it out manually when you were done with any data transfer you wanted to do.
I think I remember some unanalyzed open source projects being cleaned out within the last few months as a first step in more regular housekeeping. (And I have no other details on that.) So you would want to keep an eye on that and watch announcements to see if other cleanup was going to happen.
And on the other hand, if it’s a private project, then it will cost you to maintain every month.
Turns out that’s not the behaviour we actually got.
We transferred the repo to another organization but we still able to send results to the old SonarCloud project. It doesn’t report the results back to GitHub though.
Also, now when I try to import the transfered repo to the new SonarCloud organization it says that the project is imported already. What are we supposed to do in that case? Should we actually delete the project from the old organization to import it to the new one?
The UI is telling you the project is already imported into the organization you’re currently logged in to. Which one is that? The old one or the new one?
Not like we really want to do that. Just an observation. I honestly didn’t expect being able to do that.
Both organizations are added to my account (I’m an admin in both of them) and it doesn’t seem I can log out from them separately (I only see an option to log out from my account).
Currently the list of projects in the new organization is empty but when I try to add the transferred repo it is displayed as already imported in the list of repositories of the new organization. It’s not displayed in the list of the repositories of the old organization.
As you said, you still own / have access to both orgs. So where your analysis results go depends on the analysis parameters. I.e. you need to change your sonar.organization value.