- SonarQube Community Server v9.9.8
- dotnet-sonarscanner v9.0.2 with openjdk17
- Bamboo Server v9.9.6
We have CI pipelines defined by a bamboo.yml file and LinkedRepositories in Bamboo.
The standard configuration of a LinkedRepository is “Enable repository caching on agents” enabled which saves some resources during the build. So the code checkout is automatically done using a reference to a local git repository (to optimize the cloning operation and not download from the remote repository).
With this configuration the dotnet-sonarscanner errors with:
This git repository references another local repository which is not well supported. SCM information might be missing for some files. You can avoid borrow objects from another local repository by not using --reference or --shared when cloning it.
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Failed to find all committed files
at org.sonar.scm.git.CompositeBlameCommand.collectAllCommittedFiles(CompositeBlameCommand.java:124)
at org.sonar.scm.git.CompositeBlameCommand.blame(CompositeBlameCommand.java:76)
at org.sonar.scanner.scm.ScmPublisher.publish(ScmPublisher.java:87)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:373)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 7fb24b743582518b9eb4238a19c46c1ddc5ac4d2
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:135)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:214)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1081)
at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:992)
at org.sonar.scm.git.CompositeBlameCommand.collectAllCommittedFiles(CompositeBlameCommand.java:111)
... 22 more
ERROR:
The SonarScanner did not complete successfully
There was already a thread about it some years ago.
The workaround was to disable the repository caching. This works for us, but is not so nice.
There was also a fix promised in March 2020 with this JIRA issue.
But this issue does not exist any more. Do you know the progress of this fix?
Is there anything else to use the dotnet-sonarscanner together with a Git repository which has references to another repository?