Jenkins & Sonar: fails after "Get boostrap completed"

Currently have:

  • Jenkins (version 2.289.2)
  • SonarQube (Community Edition Version 8.5.1 (build 38104))
    Running in GCP Kubernetes.

I’m currently integrating SonarQube in Jenkins and after having configured SonarQube server and SonarQube scanner in Jenkins.

To test if everything is ok I put up a simple test:

  • Cloning a GIT repo with a HelloWorld java in it

But this error keeps appearing:

[sonar_teste] $ /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQube_scanner/bin/sonar-scanner -X -Dsonar.host.url=https://XXXXXX/sonar ******** -Dsonar.projectKey=XXX -Dsonar.sourceEncoding=UTF-8 -Dsonar.projectBaseDir=/var/jenkins_home/workspace/sonar_teste
13:43:41.766 INFO: Scanner configuration file: /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQube_scanner/conf/sonar-scanner.properties
13:43:41.769 INFO: Project root configuration file: NONE
13:43:41.821 INFO: SonarScanner 4.6.2.2472
13:43:41.821 INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
13:43:41.821 INFO: Linux 5.4.104+ amd64
13:43:42.129 DEBUG: keyStore is : 
13:43:42.130 DEBUG: keyStore type is : pkcs12
13:43:42.130 DEBUG: keyStore provider is : 
13:43:42.130 DEBUG: init keystore
13:43:42.131 DEBUG: init keymanager of type SunX509
13:43:42.393 DEBUG: Create: /var/jenkins_home/.sonar/cache
13:43:42.393 INFO: User cache: /var/jenkins_home/.sonar/cache
13:43:42.394 DEBUG: Create: /var/jenkins_home/.sonar/cache/_tmp
13:43:42.397 DEBUG: Extract sonar-scanner-api-batch in temp...
13:43:42.401 DEBUG: Get bootstrap index...
13:43:42.401 DEBUG: Download: https://xxxxxxxxxxxx/sonar/batch/index
13:43:43.338 DEBUG: Get bootstrap completed
13:43:43.356 INFO: ------------------------------------------------------------------------
13:43:43.356 INFO: EXECUTION FAILURE
13:43:43.356 INFO: ------------------------------------------------------------------------
13:43:43.357 INFO: Total time: 1.626s
13:43:43.380 INFO: Final Memory: 5M/20M
13:43:43.380 INFO: ------------------------------------------------------------------------
13:43:43.380 ERROR: Error during SonarScanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
	at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)
	at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to parse entry in bootstrap index: 
	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.parse(BootstrapIndexDownloader.java:59)
	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:44)
	at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
	at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
	... 7 more
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE

The bootstrap index url returns:
sonar-scanner-engine-shaded-8.5.1.38104-all.jar|faeadd9760e8783594e743c495ad7d99

I search solutions but nothing seems to solve it.

Hi,

Welcome to the community!

You say you’ve checked the batch/index and get a valid-looking response (at least based on what I see from our dogfooding instance). When you checked it, did you copy/paste the URL from the log? I.e. were you checking exactly the same URL as Jenkins?

Assuming the answer to that^ is ‘yes’, is it possible that there’s something on the network (e.g. a proxy) that allows your traffic to SonarQube but blocks Jenkins’?

 
Ann

1 Like

Hi, @ganncamp thanks for replying.
Yes, I copied the address link directly from Jenkins and that worked

Both Jenkins and SonarQube have AzureAD SSO authentication and I have an nginx ingress controller on GCP and I did inspect if anything showed up in the pod logs but it doesn’t appear any error.

EDIT:
The only thing that is a bit of on the NGINx Ingress Controller Logs is theese lines:

10.0.1.233 - - [11/Aug/2021:08:40:35 +0000] "GET /sonar/batch/index HTTP/2.0" 401 0 "-" "ScannerCLI/4.6.2.2472" 0 0.009 [default-sonar-svc-9000] [] xx.xxx.xxx.xx:443 0 0.009 401 943ab489dc93850dea975e566ceaa98d
10.0.1.233 - - [11/Aug/2021:08:40:35 +0000] "GET /sonar/batch/index HTTP/2.0" 302 138 "-" "ScannerCLI/4.6.2.2472" 65 0.009 [default-sonar-svc-9000] [] - - - - 943ab489dc93850dea975e566ceaa98d
10.0.1.233 - - [11/Aug/2021:08:40:35 +0000] "GET /oauth2/start?rd=%2Fsonar%2Fbatch%2Findex HTTP/2.0" 302 435 "-" "ScannerCLI/4.6.2.2472" 37 0.003 [default-oauth2-proxy-4180] [] yy.yy.y.y:4180 435 0.003 302 4c47f801f3310f02d70abae8d674bc4f
10.0.1.232 - - [11/Aug/2021:08:40:40 +0000] "GET /oauth2/auth HTTP/1.1" 202 0 "https://AAAAAAA.nip.io/jenkins/job/sonar_teste/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0" 8210 0.002 [default-oauth2-proxy-4180] [] yy.yy.y.y:4180 0 0.003 202 62f729cf75d5ab0ccab27aa9d2abb4b5

I build and watched live the logs and after this line appear it stopped.

I kept thinking about what you said and I accessed the Jenkins pod and tried to curl the url/batch/index and it can’t access it as you can see:

jenkins@jenkins-0:/$ curl https://url.xxx.xxx.xx.nip.io/sonar/batch/index
<html>
<head><title>302 Found</title></head>
<body>
<center><h1>302 Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

But when I access from my local browser it shows the
sonar-scanner-engine-shaded-8.5.1.38104-all.jar|faeadd9760e8783594e743c495ad7d99

Hi,

You’re one step ahead of me. That’s^ exactly what I was going to ask you to try next. So… it looks like you need to talk to your network folks or whomever admins your Nginx.

 
Ann

I already did it, it turns out that on the url field I needed to put the “http://sonar-service:9000/sonar” to this to work.
I was putting the actual URL that people can acess sonar!

Now I’m getting a:

Bad Message 431
reason: Request Header Fields Too Large

Another error to find and solve :slight_smile:

Thanks @ganncamp

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.