Integration with Azure DevOps fails

(Michael Morozov) #1

We can’t get SonarCloud working in a Azure DevOps build pipeline. It works for other projects, but on this particular one the Run Code Analysis step ends up in an error:

ERROR: Error during SonarQube Scanner execution
ERROR: Unable to load component class org.sonar.scanner.scan.filesystem.ProjectFileIndexer
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.filesystem.FileIndexer
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.filesystem.MetadataGenerator
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.filesystem.StatusDetection
ERROR: Caused by: Unable to load component class org.sonar.scanner.scm.ScmChangedFiles
The SonarQube Scanner did not complete successfully
20:28:51.607 Post-processing failed. Exit code: 1
D:\a_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.6.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe failed with return code: 1

(Julien Henry) #2

Hi again @michaelm ;),

From the debug logs you sent to me privately, here is the interesting part of the error:

Caused by: java.lang.NullPointerException
	at org.eclipse.jgit.lib.ObjectIdOwnerMap.get(
	at org.eclipse.jgit.revwalk.RevWalk.parseAny(
	at org.eclipse.jgit.revwalk.RevWalk.parseCommit(
	at org.sonarsource.scm.git.GitScmProvider.prepareTreeParser(
	at org.sonarsource.scm.git.GitScmProvider.branchChangedFiles(
	at org.sonar.scanner.scm.ScmChangedFilesProvider.loadChangedFilesIfNeeded(

I don’t think you are using shallow clone (we are detecting it and should log a warning) but could you confirm?

(Michael Morozov) #4

We are using “Shallow fetch” option with Depth = 1. I assume it is the same thing?

(Julien Henry) #5

Probably yes. Strange you don’t see a warning about that. Now I’m thinking of it, the detection of shallow clone is probably only done during the blame phase, which happen later.

Can you try to disable shallow clone and see if it solves your issue?