Versions
Jenkins 2.440.2, declarative Pipeline, Jenkinsfile
SonarQube: Developer Edition Version 10.4.1 (build 88267)
Maven-Plugin: org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922
how is SonarQube deployed:
Docker, Jenkins too
what are you trying to achieve
Scanning of TypeScript fails, bridge cannot be started.
what fails
10:42:56 [INFO] 10:42:55.938 Sensor JavaScript inside HTML analysis [javascript]
10:42:56 [DEBUG] 10:42:55.940 Deploying bundle
10:42:56 [DEBUG] 10:42:55.941 Deploying the bridge server into /var/jenkins_home/workspace/OCSIG-1642-java-17-auf-sonarqube/target/sonar/.sonartmp/bridge-bundle
10:42:59 [DEBUG] 10:42:59.130 Deploying bundle (done) | time=3190ms
10:42:59 [INFO] 10:42:59.130 Detected os: Linux arch: amd64 alpine: false. Platform: LINUX_X64
10:42:59 [DEBUG] 10:42:59.134 Currently installed Node.js version: v20.9.0. Available version in analyzer: v20.9.0
10:42:59 [DEBUG] 10:42:59.134 Skipping node deploy. Deployed node has latest version.
10:42:59 [DEBUG] 10:42:59.136 Launching command /var/jenkins_home/.sonar/js/node-runtime/node -v
10:42:59 [DEBUG] 10:42:59.159 Deployed node version v20.9.0
10:42:59 [DEBUG] 10:42:59.160 Deploying custom rules bundle jar:file:/var/jenkins_home/.sonar/cache/91ab6512fd5d7f04f34afa1cedc7714f/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /var/jenkins_home/workspace/OCSIG-1642-java-17-auf-sonarqube/target/sonar/.sonartmp/bridge-bundle/package/custom-rules374271307379837562
10:42:59 [DEBUG] 10:42:59.164 Starting server
10:42:59 [DEBUG] 10:42:59.166 Creating Node.js process to start the bridge server on port 43019
10:42:59 [INFO] 10:42:59.167 Configured Node.js --max-old-space-size=4096.
10:42:59 [INFO] 10:42:59.167 Using embedded Node.js runtime
10:42:59 [INFO] 10:42:59.167 Using Node.js executable: '/var/jenkins_home/.sonar/js/node-runtime/node'.
10:42:59 [DEBUG] 10:42:59.167 Checking Node.js version
10:42:59 [DEBUG] 10:42:59.167 Launching command /var/jenkins_home/.sonar/js/node-runtime/node -v
10:42:59 [DEBUG] 10:42:59.179 Using Node.js v20.9.0.
10:42:59 [DEBUG] 10:42:59.179 Launching command /var/jenkins_home/.sonar/js/node-runtime/node --max-old-space-size=4096 /var/jenkins_home/workspace/OCSIG-1642-java-17-auf-sonarqube/target/sonar/.sonartmp/bridge-bundle/package/bin/server 43019 127.0.0.1 /var/jenkins_home/workspace/OCSIG-1642-java-17-auf-sonarqube/client-ui/target/sonar true false false /var/jenkins_home/workspace/OCSIG-1642-java-17-auf-sonarqube/target/sonar/.sonartmp/bridge-bundle/package/custom-rules374271307379837562/package
10:43:02 [INFO] 10:43:01.951 Memory configuration: OS (23947 MB), Node.js (4144 MB).
10:43:02 [DEBUG] 10:43:01.952 Starting the bridge server
10:43:02 [DEBUG] 10:43:01.964 The bridge server is listening on port 43019
10:43:02 [DEBUG] 10:43:02.054 The worker thread is running
10:43:20 [DEBUG] 10:43:16.967 The bridge server shut down
10:43:20 [DEBUG] 10:43:17.010 The worker thread exited with code 1
10:48:11 [ERROR] 10:47:59.211 Failed to start the bridge server (300s timeout)
10:48:11 org.sonar.plugins.javascript.nodejs.NodeCommandException: Failed to start the bridge server (300s timeout)
10:48:11 at org.sonar.plugins.javascript.bridge.BridgeServerImpl.startServer(BridgeServerImpl.java:197)
10:48:11 at org.sonar.plugins.javascript.bridge.BridgeServerImpl.startServerLazily(BridgeServerImpl.java:304)
what have you tried so far to achieve this
Jenkinsfile pipeline currently looks like this:
stage('SonarQube scanner analysis') {
steps {
script {
withSonarQubeEnv('Sonar') {
nodejs(nodeJSInstallationName: 'NodeJS 20') {
withEnv(['NO_PROXY=127.0.0.1,localhost', 'NODE_OPTIONS=--trace-exit']) {
sh("""\
echo ${NO_PROXY}
npm config ls
JAVA_HOME=${JDK17_HOME} \
mvn \
${JENKINS_PROXY} \
-Dsonar.javascript.node.maxspace=4096 \
-Dsonar.verbose=true \
-Dsonar.log.level=DEBUG \
org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar -X\
""")
}
}
}
}
}
}
I am not sure why I am getting “The worker thread exited with code 1”. I cannot see anything in docker logs why the thread exited with code 1.
It might be a networking issue, but I am not able to exclude 127.0.0.1 from being proxied. In the proxy logs I can see requests to 127.0.0.1 with the metioned port.
I tried to exclude it via ${JENKINS_PROXY}:
-Dhttp.proxyHost=xxx -Dhttp.proxyPort=xxx -Dhttps.proxyHost=xxx -Dhttps.proxyPort=xxx -Dhttp.nonProxyHosts=127.0.0.1
I added NO_PROXY environment variable (thought it might work for node binary).
Questions:
- How can I get more details about what exactly makes the worker thread fail?
- How can I exclude 127.0.0.1 from being proxied?
- How could I disable the whole “node”-dependency from being used at all as a quick-fix?