Run Code Analysis in Azure Devops

Hello Team,

I have seen many topics around this error in sonar community. However, i am unable to find accurate solution, after checking the solutions provided.

Error:

  1. 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

ERROR:

ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

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

ERROR:

ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

##[error]The process ‘/home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.4.0/sonar-scanner/bin/sonar-scanner’ failed with exit code 1

Finishing: SonarQubeAnalyze

Where is Sonar Server Running & Whats its configuration.???

Server configuration:
My Sonar server is running on the following VM on Azure cloud ----
OS : Ubuntu 20.4
Port: 9000
Inbound port rules allowed: 443, 9000, 22,8080
Protocols Allowed: TCP
Firewall: No firewall rules

What did i write in YAML file, in Azure?

- task: SonarQubePrepare@5
  inputs:
    SonarQube: 'Sonar_Service_Connection'
    scannerMode: 'CLI'
    configMode: 'manual'
    cliProjectKey: 'Sample_key'
    cliProjectName: 'Sonar'
    cliSources: '/home/vsts/work/1/s/'
    extraProperties: 'sonar.exclusions=**/*.bin'

_____

I have tried few solutions provided in this community and needing some resolution.

Thread is not relevant error: Caused by: java.lang.IllegalStateException: Fail to parse entry in bootstrap index - is also removing plugin auth aad

Edition: Community

  • Verified the URL and it looks accurate with no white spaces.
  • No proxies set on my sonar server
  • Verified Plugins and 48 plugins are available, ( not sure if there should be very specific).
  • Verified global address

Yet i have issues and cannot resolve this error for a week. Any suggestion will greatly appreciated.

Hey there.

Let me suggest turning on DEBUG logging (sonar.verbose=true) and looking for the precise URL that is being called in this step.

11:04:53.936 Get bootstrap index...
11:04:53.936 Download: https://sonarcloud.io/batch/index
1:04:54.413 Get bootstrap completed

Is this specific URL valid and returning data?

Sorry for late response. My sonar server crashed yesterday and i had to work with my team to rebuild another one and reached this stage again.

So i have added this property and below is my pipeline task with this property included.

  • task: SonarQubePrepare@5
    inputs:
    SonarQube: ‘sunilk270985_Demo’
    scannerMode: ‘CLI’
    configMode: ‘manual’
    cliProjectKey: ‘sunilk270985_Demo’
    cliProjectName: ‘sonar’
    cliSources: ‘.’
    extraProperties: |
    sonar.exclusions=**/*.bin
    sonar.verbose = true

I have ran the pipeline again and i see the following errors.


  1. at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)

##[error]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 java.base/java.security.AccessController.doPrivileged(Native Method)

at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)

##[error]at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)

at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)

at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)

at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)

##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:73)

at org.sonarsource.scanner.cli.Main.main(Main.java:61)

at org.sonarsource.scanner.cli.Main.execute(Main.java:73)

at org.sonarsource.scanner.cli.Main.main(Main.java:61)

##[error]Caused by: java.lang.IllegalStateException: Fail to parse entry in bootstrap index:

Caused by: java.lang.IllegalStateException: Fail to parse entry in bootstrap index:

##[error]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.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)

##[error]at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)

at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)

at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)

##[error]… 7 more

ERROR:

… 7 more

ERROR:

##[error]ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

##[error]The process ‘D:\a_tasks\SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055\5.4.0\sonar-scanner\bin\sonar-scanner.bat’ failed with exit code 1

Finishing: SonarQubeAnalyze

So looking at this , i dont think its returning any data? Let me know your suggestions

So the following code worked finally. The error that i was making whole time, was not specifying present working directory,

cliSources: ‘.’

by using this, it fixed and my sonar scan ran w/o issues.

  • task: SonarQubePrepare@5
    inputs:
    SonarQube: ‘sunilk270985_Demo’
    scannerMode: ‘CLI’
    configMode: ‘manual’
    cliProjectKey: ‘sunilk270985_Demo’
    cliProjectName: ‘sonar’
    cliSources: ‘.’
    extraProperties: |
    sonar.exclusions=/*.bin
    sonar.verbose = true
    sonar.language=java
    sonar.java.binaries=
    /target/classes