Ran Steps Manually but Not Displaying in SonarQube

We are continuing to have issues getting SonarQube setup with Jenkins and BitBucket. Now that our CERT issues are resolved, our Jenkinsfile does not appear to be correct. Therefore, I attempted to run the process manually on our build server to simulate what would happen upon a Build.

It appears to all run just fine, but nothing appears in SonarQube. Any thoughts or ideas?

Result of Last Step:

Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
Calling the TFS Processor executable...
The TFS Processor has finished
Calling the SonarScanner CLI...
The SonarScanner CLI has finished
13:03:29.874  Post-processing succeeded.

Hi,

Can you share the full job log?

 
Ann

We are having continued problems getting our SonarQube integration with Jenkins up and going. Here is our latest error:

SonarScanner for MSBuild 5.11
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
15:42:51.545  15:42:51.545  WARNING: File 'C:\ws2\workspace\RosterApps_SonarQube_dev\RosterApps.Web\AngularProjects\TimeAndAttendance\src\app\components\date-picker\date-picker.component.spec.ts' does not exist.
Calling the TFS Processor executable...
The TFS Processor has finished
Calling the SonarScanner CLI...
The SonarScanner CLI has finished
15:42:51.908  Post-processing succeeded.
[Pipeline] }
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Quality Gate)
[Pipeline] timeout
Timeout set to expire in 10 min
[Pipeline] {
[Pipeline] withSonarQubeEnv
Injecting SonarQube environment variables using the configuration: Arcos-Sonarqube
[Pipeline] {
[Pipeline] waitForQualityGate
[Pipeline] }
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.IllegalStateException: Unable to guess SonarQube task id and/or SQ server details. Please use the 'withSonarQubeEnv' wrapper to run your analysis.

Snippet from our Jenkinsfile:

        stage('SonarQube Analysis') {
            environment {
              msbuildHome = tool 'MSBuild 16.10'
              scannerHome = tool 'SonarScanner for MSBuild for RosterApps'
            }
        
            steps {
              withSonarQubeEnv('Arcos-Sonarqube') {
                bat "\"${scannerHome}\\SonarScanner.MSBuild.exe\" begin /k:\"SOME_VALUE\""
                powershell('''
                        Write-Host "Starting RosterApps.Web Build"
                        $env:PATH = "$env:PATH;C:\\Program Files\\nodejs;C:\\Users\\sa_jenkins\\AppData\\Roaming\\npm"
                        "appSettings.config", "connectionStrings.config", "qciFramework.config" | ForEach-Object {
                            Copy-Item $env:WORKSPACE\\RosterApps.Web\\ConfigTemplates\\$_ $env:WORKSPACE\\RosterApps.Web\\Config -Recurse -Force
                        }
                    ''')
                bat "\"${msbuildHome}\\MSBuild.exe\" RosterApps.Web\\RosterApps.Web.csproj /p:DeployOnBuild=true /p:PublishProfile=Debug.pubxml /p:Configuration=Debug /p:Platform=AnyCPU /p:VisualStudioVersion=16.0 /p:NoWarn=1591 /t:Clean /t:Rebuild /p:CurrentDirectory=%~dp0\\ -v:quiet"
                
                powershell('''
                        Write-Host "Starting RosterApps.Web Angular Build"
                        # Angular Build
                        cd $env:WORKSPACE\\RosterApps.Web
                        ng build EnhancedVacationBidding --output-path="..\\RosterApps.Web.Deploy\\Publish Debug\\EnhancedVacationBidding" --configuration production
                        ng build TimeAndAttendance --output-path="..\\RosterApps.Web.Deploy\\Publish Debug\\TimeAndAttendance" --configuration production
                    ''')
                    
                bat "\"${scannerHome}\\SonarScanner.MSBuild.exe\" end"                              
              } 
            }
        }

        stage ("Quality Gate") {
            steps {
                timeout(time: 10, unit: 'MINUTES') {
                    withSonarQubeEnv('Arcos-Sonarqube') { waitForQualityGate abortPipeline: true }
                }
            }
        }

Thanks,

Tony

Hi Tony,

I’ve combined your two threads since they seem to be related. Can you share your full, verbose log?

  • Add /d:"sonar.verbose=true" to the…
    • SonarScanner.MSBuild.exe or dotnet sonarscanner begin command to get more detailed logs
      • For example: SonarScanner.MSBuild.exe begin /k:"MyProject" /d:"sonar.verbose=true"
    • “SonarQubePrepare” or “SonarCloudPrepare” task’s extraProperties argument if you are using Azure DevOps
      • For example:
        - task: SonarCloudPrepare@1
            inputs:
              SonarCloud: 'sonarcloud'
              organization: 'foo'
              scannerMode: 'MSBuild'
              projectKey: 'foo_sonar-scanning-someconsoleapp'
              projectName: 'sonar-scanning-someconsoleapp'
              extraProperties: |
                sonar.verbose=true
        
  • The important logs are in the END step (i.e. SonarQubeAnalyze / SonarCloudAnalyze / “Run Code Analysis”)

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d

or

dotnet build -v:d

 
Ann