Setting up Quality Gate Check for Existing Projects in SonarQube on Azure DevOps

Problem:

When I create a new project on SonarQube, and I add the corresponding project key in the Azure DevOps pipeline, the Quality Gate check works as expected. The pipeline completes successfully, and the quality gate status is correctly reflected.

However, when I try to set up the same process for an existing project in SonarQube (i.e., using the project key of an already existing project), the Quality Gate check in the Azure DevOps pipeline is stuck in a waiting state, and it never completes.

Steps I’ve Taken So Far:

  1. I have added the SonarQube extension to Azure DevOps.
  2. I’ve correctly configured the SonarQube service connection in Azure DevOps.
  3. I added the SonarQubePrepare, SonarQubeAnalyze, and SonarQubePublish tasks to the pipeline YAML, as outlined in the SonarQube documentation.
  4. I’ve checked that the project key is correctly configured in both SonarQube and the Azure DevOps pipeline.

Despite these efforts, the Quality Gate check for the existing project in SonarQube continues to show as “waiting”.

What I’ve Noticed:

  1. New projects in SonarQube work perfectly fine with the quality gate check once the project key is configured in the Azure DevOps pipeline.
  2. Existing projects cause the quality gate status to stay in a “waiting” state, which does not change even after the analysis completes.

What I’m Looking for:

  • How do I properly set up the quality gate check for an existing project in SonarQube on Azure DevOps?
  • Are there any additional configurations or steps that need to be performed specifically for existing projects to work with the quality gate check?
  • How can I troubleshoot this issue effectively to ensure that the Quality Gate check runs successfully for existing SonarQube projects in my Azure DevOps pipeline?

Hey there.

Have you made sure that the project-level settings at Project Settings > General Settings > DevOps Platform Integration have been configured?

For your new projects being provisioned through the onboarding wizard, these properties are filled out automatically. For old projects, they still need to be filled in.