Sonar-scanner - "Fail to parse entry in bootstrap index.."

Hi, all.
I have a strange problem.
My stack:

  • SonarQube Data Center Edition - Version 7.9.2 (build 30863)
  • Jenkins 2.204.1 + SonarQube Scanner plugin
  • sonar-scanner 4.0.0.1744 on Jenkins

Check the link from Jenkins to SonarQube:

  curl -k https://sonar.my.ru/batch/index
  scanner-datacentr-7.9.2-all.jar|cecd7733fdf504df8f46fdcdc2ght2c78b
  Finished: SUCCESS

I created Jenkins pipeline for test analysis simple .yaml file.

pipeline {
   agent {
      label 'master'
   }
   stages {
      stage('BitBucket') {
         steps {
            git branch: 'XXX', credentialsId: 'YYY', url: 'https://bitbucket.my.ru/repo.git'
         }
      }
      stage('Sonarqube') {
         environment {
            scannerHome = tool 'sonar-scanner'
         }
         steps {
            withSonarQubeEnv('SonarSigma') {
                sh "${scannerHome}/bin/sonar-scanner -Dsonar.login=${SONAR_AUTH_TOKEN}"
            }
            timeout(time: 10, unit: 'MINUTES') {
               waitForQualityGate abortPipeline: true
            }
         }
      }
   }
}

There is sonar-project.properties in root directory of project

sonar-project.properties
sonar.projectKey=ru.org.project:repo
sonar.projectName=project :: Services :: repo
sonar.sources=.
sonar.host.url=https://sonar.my.ru
sonar.log.level=DEBUG

After start Jenkins pipeline, I get error in stage(‘Sonarqube’)

[Pipeline] stage
[Pipeline] { (Sonarqube)
[Pipeline] tool
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withSonarQubeEnv
Injecting SonarQube environment variables using the configuration: SonarSigma
[Pipeline] {
[Pipeline] sh
[check_sonar] Running shell script
+ /opt/sonar-scanner-4.0.0.1744-linux/bin/sonar-scanner -Dsonar.login=******
INFO: Scanner configuration file: /opt/sonar-scanner-4.0.0.1744-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /opt/jenkins/workspace/SANDBOX/check_sonar/sonar-project.properties
11:30:46.026 INFO: SonarQube Scanner 4.0.0.1744
11:30:46.028 INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
11:30:46.028 INFO: Linux 3.10.0-693.11.6.el7.x86_64 amd64
11:30:46.171 DEBUG: keyStore is : 
11:30:46.171 DEBUG: keyStore type is : pkcs12
11:30:46.171 DEBUG: keyStore provider is : 
11:30:46.171 DEBUG: init keystore
11:30:46.172 DEBUG: init keymanager of type SunX509
11:30:46.282 DEBUG: Create: /var/lib/jenkins/.sonar/cache
11:30:46.283 INFO: User cache: /var/lib/jenkins/.sonar/cache
11:30:46.283 DEBUG: Create: /var/lib/jenkins/.sonar/cache/_tmp
11:30:46.285 DEBUG: Extract sonar-scanner-api-batch in temp...
11:30:46.288 DEBUG: Get bootstrap index...
11:30:46.288 DEBUG: Download: https://sonar.my.ru/ /batch/index
11:30:46.530 DEBUG: Get bootstrap completed
11:30:46.534 INFO: ------------------------------------------------------------------------
11:30:46.534 INFO: EXECUTION FAILURE
11:30:46.534 INFO: ------------------------------------------------------------------------
11:30:46.534 INFO: Total time: 0.571s
11:30:46.548 INFO: Final Memory: 3M/14M
11:30:46.549 INFO: ------------------------------------------------------------------------
11:30:46.549 ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
	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:181)
	at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:122)
	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: <!doctype html><html lang="en">
...SOME BIG HTML CODE...
><body><div id="content"><div class="global-loading"><i class="spinner global-loading-spinner"></i> <span class="global-loading-text">Loading...</span></div></div><script>window.baseUrl = '';
	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
11:30:46.552 ERROR: 
11:30:46.552 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

As I understand it, the scanner does not get what it expects? I already broke my head with this problem.

Hi,

Welcome to the community!

Instead of getting a jar, an HTML error page is being returned. You need to double-check your Jenkins global configuration where the SonarQube instance is set up and make sure the URL is correct. If it is, then check the network to see what’s interfering with the call.

 
HTH,
Ann

1 Like

Hi, Ann
You’re right! I found my trouble. URL of SonarQube contained some error - slash at the end + one extra space. After the correcting URL SonarQube at Jenkins - Configure System - SonarQube servers, everything worked.

Thanks for the help.

1 Like

Thank you, the hint with trailing slash and additional space was exactly my problem.