From: Mark Rekveld Date: Thu, 10 Sep 2020 09:48:56 +0000 (+0200) Subject: [DOCS] Updated Sonar Scanner for Jenkins (#3129) X-Git-Tag: 8.5.0.37579~80 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4efc3c9eebe2f0e7a19e2a2a0a6edb99572d0b2a;p=sonarqube.git [DOCS] Updated Sonar Scanner for Jenkins (#3129) --- diff --git a/server/sonar-docs/src/pages/analysis/scan/sonarscanner-for-jenkins.md b/server/sonar-docs/src/pages/analysis/scan/sonarscanner-for-jenkins.md index e5a493009e9..5ca6c5a8180 100644 --- a/server/sonar-docs/src/pages/analysis/scan/sonarscanner-for-jenkins.md +++ b/server/sonar-docs/src/pages/analysis/scan/sonarscanner-for-jenkins.md @@ -85,6 +85,14 @@ We provide a `withSonarQubeEnv` block that allows you to select the SonarQube se If needed you can override the `credentialId` if you don't want to use the one defined in global configuration (for example if you define credentials at folder level). +If you only need the SonarQube environment variables to be expanded in the build context then you can override the `envOnly` flag. +``` +withSonarQubeEnv('My SonarQube Server', envOnly: true) { + // This expands the evironment variables SONAR_CONFIG_NAME, SONAR_HOST_URL, SONAR_AUTH_TOKEN that can be used by any script. + println ${env.SONAR_HOST_URL} +} +``` + Here are a some examples for every scanner, assuming you run on Unix slaves and you have configured a server named "My SonarQube Server" as well as required tools. If you run on Windows slaves, just replace `sh` with `bat`. SonarScanner: