Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-72033

Sonar errors linked to an old configuration in Jenkins

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • sonar-plugin
    • None
    • Jenkins version: 2.414.1
      SonarQube Scanner for Jenkins plugin version: 2.15
      sonar-scanner-cli: 4.8.0.2856 (or 4.8.1.3023)
      SonarQube server version: 9.9.0.65466 (Community Edition)

      Hello,
       
      I am not sure if this is the right place for it but I am struggling with the following matter.
      I configured a Jenkins Multibranch pipeline which runs a SonarQube analysis against my whole code (it consists in a Maven project and a React application).
      Here is the sample of code of my Jenkins pipeline for running it:

      stage('SonarQube Analysis') {
        environment {
          scannerHome = tool 'main-sonarqube-scanner'
        }
        steps {
          withSonarQubeEnv(installationName: "SonarQube-MYPROJ") {
            sh '${scannerHome}/bin/sonar-scanner -Dsonar.projectName=wave-other-branches -Dsonar.projectKey=MYPROJ -Dproject.settings=sonar-project.properties'
        }
      }}
      
      stage("Quality Gate") {
        steps {
          timeout(time: 2, unit: 'MINUTES') {
            waitForQualityGate abortPipeline: true
        }
      }}

       
      Here is the content of my sonar-project.properties:
       

      sonar.sourceEncoding=UTF-8
      sonar.cfamily.threads=4
      sonar.java.skipUnchanged=true
      sonar.language=java
      sonar.exclusions=scripts/**
      sonar.java.binaries=**/*
      sonar.java.libraries=**/target/*.jar
      sonar.python.version=3
      sonar.filesize.limit=120

       
       
      From Manage Jenkins > Tools, I configured a SonarQube Scanner with the name "main-sonarqube-scanner", installed automatically from Maven Central with version 4.8.0.2856.
      From Manage Jenkins > System, I configured a SonarQube server with the name "SonarQube-MYPROJ" with the URL from our SonarQube server specified and Server authentication token.
       
      Everything works perfectly fine, the analysis is run and I successfully see the Quality Gate result when looking at a job.
       
      However, I noticed some errors in the Jenkins Logs:
      sept. 18, 2023 2:44:26 PM INFOS hudson.plugins.sonar.client.SQProjectResolver resolve
      Invalid installation name: MYPROJ
       
      I added a Log Recorder for Sonar and everytime a new analysis is run there are such following errors:
      sept. 18, 2023 2:42:53 PM PRÉCIS hudson.plugins.sonar{{{}Error fetching project information: Error 404 on http://[sonarqube-server-ip]:8090/api/qualitygates/project_status?analysisId=AYkInrGTShl6_xF5mUhN : {"errors":[

      {"msg":"Analysis with id \u0027AYkInrGTShl6_xF5mUhN\u0027 is not found"}

      ]}{}}}sept. 18, 2023 2:44:26 PM PRÉCIS hudson.plugins.sonar[...]sept. 18, 2023 2:44:26 PM INFOS hudson.plugins.sonar.client.SQProjectResolver resolveInvalid installation name: MYPROJsept. 18, 2023 2:44:26 PM PRÉCIS hudson.plugins.sonar
       
      The installation name "MYPROJ" is the name of an old configuration that no longer exists and it is not referenced anymore by any Jenkins project, which is why I don't understand why it seems still to be used by sonar-scanner.
      I tried cleaning the folder /var/lib/jenkins/.sonar/cache and upgrading the sonar-scanner-cli to version 4.8.1.3023 but I still encounter these errors.
      Can you help me understand why this former installation name and these (old, I guess) analysis are fetched? What can I do to avoid such errors from happening?
       
      Best regards

            sonarteam Sonar Team
            lbonapfel Lucie
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: