Provision new project from analyzing a branch

When pushing analysis results, we get a series of error messages, followed by:

Caused by: Project was never analyzed. A regular analysis is required before a branch analysis

I found that this is caused by analyzing a branch for a project that hasn’t been analyzed before. From what I understand, there are two ways to solve this: create the project manually before analyzing or analyze the master/main branch first.

Analyzing the master branch first is problematic, since it’s protected and can only be changed through completing a PR. The yaml build script (we’re using azure devops) is part of the same repository and subject to this policy. Changing the build definition to include sonarqube analysis can therefor only be done on a branch and a succesful build is required as part of the PR.

Manually creating the project beforehand is impractical, since people that create new projects in azure devops are not the same that configure SonarQube and in some cases projects and builds are created or changed using scripts that don’t have hooks to SonarQube.

So I would like to suggest to allow provisioning a new project from analyzing a branch, in a similar way to what happens when creating a new project manually (ie. without code analysis results from master).

We’re using SonarQube Enterprise version 7.9.4 (on-premises). While I understand that there are newer versions available, I haven’t found any indication that newer versions act differently on new projects.

Last I checked this behavior was different for us on the latest version (8.6 DE). Don’t know if that is expected but we no longer have to run the master build as the first build iirc.

I would like to get this confirmed. We’ll probably wait for the next LTS, but then this feature suggestion can be closed.

We’re running 8.6. Can confirm you can analyze a branch without having an analysis of master. It will provision the project automatically. If you look at the master branch of the project there’s a message stating that branch is empty. Other branches can still be analyzed.

Thank you for the replies. Good to know this has been changed in recent versions. We’ll wait for the next LTS which given the release indication of 1,5 year should be released soon.

In any case, this feature request can be closed.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.