-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
- Jenkins: 2.89.3 running as a docker image (https://hub.docker.com/r/jenkinsci/blueocean/) on Ubuntu 16.04
- Kubernetes plugin: 1.1.3
- SonarQube Scanner for Jenkins: 2.6.1
withSonarQubeEnv in Jenkins pipeline is not setting SonarQube environment variables whe using it with Kubernetes:
[Pipeline] // stage [Pipeline] stage [Pipeline] { (SonarQube analysis) [Pipeline] container [Pipeline] { Injecting SonarQube environment variables using the configuration: Sonar [Pipeline] withSonarQubeEnv [Pipeline] { [Pipeline] sh [_feature_Kubernetes_Jenkins-CRYRJCHOFOQMYJAPU6HZKKE5K4FPOWCOCOI6R45MGFPDF7YMSJEQ] Running shell script + sonar-scanner INFO: Scanner configuration file: /opt/sonar-scanner-3.0.3.778/conf/sonar-scanner.properties INFO: Project root configuration file: /home/jenkins/workspace/_feature_Kubernetes_Jenkins-CRYRJCHOFOQMYJAPU6HZKKE5K4FPOWCOCOI6R45MGFPDF7YMSJEQ/sonar-project.properties INFO: SonarQube Scanner 3.0.3.778 INFO: Java 1.8.0_151 Oracle Corporation (64-bit) INFO: Linux 4.4.0-87-generic amd64 INFO: User cache: /root/.sonar/cache ERROR: SonarQube server [http://localhost:9000] can not be reached INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO: ------------------------------------------------------------------------ INFO: Total time: 0.319s INFO: Final Memory: 5M/362M INFO: ------------------------------------------------------------------------ ERROR: Error during SonarQube Scanner execution org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84) at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71) at java.security.AccessController.doPrivileged(Native Method) at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71) at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67) at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218) at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156) at org.sonarsource.scanner.cli.Main.execute(Main.java:74) at org.sonarsource.scanner.cli.Main.main(Main.java:61) Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server at org.sonarsource.scanner.api.internal.Jars.getBootstrapIndex(Jars.java:100) at org.sonarsource.scanner.api.internal.Jars.getScannerEngineFiles(Jars.java:76) at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70) at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39) at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75) ... 8 more Caused by: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:9000
SonarQube is correctly configured and it works when using a simple Docker agent instead of Kubernetes.
I have found a forum with people having the same issue but not an open issue here.
- duplicates
-
JENKINS-49370 Environment variables cannot be set within the container step
- Resolved
- is related to
-
JENKINS-49465 Build Environment Variables not available within Container Step
- Resolved