Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Status
colourGreen
titleSince 2.5
 : you can also use Jenkins Pipeline DSL (some features require SonarQube >= 6.2).

Compatibility

SonarQube Scanner for Jenkins

2.02.12.2.x2.3 - 2.4.x2.52.62.7 - 2.8.1

Jenkins

1.344+1.491+1.580.1+1.580.3+2.7.3+
2.32.2+2.89.4+

Status
colourGreen
titleSince 2.5
 Analysis must run with a JRE8

...

Code Block
languagegroovy
titleSonarQube Scanner for MSBuild
node {
  stage('SCM') {
    git 'https://github.com/foo/bar.git'
  }
  stage('Build + SonarQube analysis') {
    def sqScannerMsBuildHome = tool 'Scanner for MSBuild 2.2'
    withSonarQubeEnv('My SonarQube Server') {
      // Due to SONARMSBRU-307 value of sonar.host.url and credentials should be passed on command line
      bat "${sqScannerMsBuildHome}\\SonarQube.Scanner.MSBuild.exe begin /k:myKey /n:myName /v:1.0 /d:sonar.host.url=%SONAR_HOST_URL% /d:sonar.login=%SONAR_AUTH_TOKEN%"
      bat 'MSBuild.exe /t:Rebuild'
      bat "${sqScannerMsBuildHome}\\SonarQube.Scanner.MSBuild.exe end /d:sonar.login=%SONAR_AUTH_TOKEN%"
    }
  }
}

Pause pipeline until quality gate is computed

...