[Quality Gate]: No previous SonarQube analysis found on this pipeline execution

Versions used:

  • Jenkins Server (2.222.3)
  • SonarScanner
  • SonarQube server 8.3.1
  • Java 1.8.0_202 Oracle Corporation (64-bit)
  • Windows 10 10.0 amd64

Error observed:

I use sonarQube to analyse both my angular frontend (UI) and .net core backend (API) projects.
For the API I use SonarScanner.MSBuild.dll and that works like a charm.
For the UI I use sonar-scanner, and that seems to work, except I see the following error in the Jenkins build summary:

[Quality Gate]: No previous SonarQube analysis found on this pipeline execution. Please use the ‘withSonarQubeEnv’ wrapper to run your analysis.

For both scans, I can see the results on the sonarQube dashboard.
I also see the badge from SonarQube Quality Gate for both UI and API
I have a report-task.txt for both scans.

Any idea what is going on here?

The following log is showed for the UI analysis. Note the last part where waitForQualityGate leads to the creation of the error badge.

 INFO: SonarScanner
 INFO: Java 1.8.0_202 Oracle Corporation (64-bit)
 INFO: Windows 10 10.0 amd64
 INFO: Analyzing on SonarQube server 8.3.1
 WARN: SonarScanner will require Java 11 to run starting in SonarQube 8.x
 INFO: Analysis report generated in 521ms, dir size=572 KB
 INFO: Analysis report compressed in 912ms, zip size=355 KB
 INFO: Analysis report uploaded in 36ms
 INFO: ANALYSIS SUCCESSFUL, you can browse https://sonarqube.xxxx.com/dashboard?id=xxxxx.ui
 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
 INFO: More about the report processing at https://sonarqube.xxxx.com/api/ce/task?id=AXN6yhUx6cGpET2eMycY
 INFO: Analysis total time: 56.639 s
 INFO: ------------------------------------------------------------------------
 INFO: ------------------------------------------------------------------------
 INFO: Total time: 1:04.874s
 INFO: Final Memory: 20M/289M
 INFO: ------------------------------------------------------------------------
[Pipeline] waitForQualityGate
[Pipeline] createSummary
[Pipeline] addErrorBadge
[Pipeline] }
[Pipeline] // withSonarQubeEnv

For the API, the last part of the logging looks the same, except that some extra lines are shown:

 The SonarQube Scanner has finished
 10:42:13.22  Post-processing succeeded.
 Checking status of SonarQube task 'AXN6yhUx6cGpET2eMycY' on server 'SonarQube Prod'
 SonarQube task 'AXN6yhUx6cGpET2eMycY' status is 'SUCCESS'
 SonarQube task 'AXN6yhUx6cGpET2eMycY' completed. Quality gate is 'OK'
[Pipeline] }
[Pipeline] // withSonarQubeEnv

steps to reproduce:

Maybe not really a step to reproduce, but I use the following code construct

    withSonarQubeEnv(credentialsId: 'sonarqube') {

        def sqScannerHome = tool 'SonarQubeScanner'
        bat """${sqScannerHome}\\bin\\sonar-scanner
            -Dsonar.projectName=\"xxxxx UI\" 
            -Dsonar.exclusions=**/*.spec.ts """

        def qg = waitForQualityGate()
        if (qg.status != 'OK') {
            currentBuild.result = "UNSTABLE"

potential workaround:

I have split up my pipeline in one for the backend and one for the frontend. The analysis seems to work correctly for both now.
So, for me, this is not an issue anymore.

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