SCM error with different sonar scanner running as docker

hey everyone,
our general setup looks like this. We run our local sonarqube developer edition and inside teamcity we run a docker container executing maven sonar:sonar and pushing everything to sonarqube.

Integration inside our bitbucket works perfect, with pull request decoration.

Now I have a python project, this can obviously not run with maven.

Therefore I have created a pipeline with two steps.

  1. run python tests with coverage in a docker container
  2. run the sonar-scanner-cli docker image

The scanner fails with two messages:
WARN Missing unknown 8e060bb2112e99ad760f46e7dacef245892f7bed
org.eclipse.jgit.errors.MissingObjectException: Missing unknown
8e060bb2112e99ad760f46e7dacef245892f7bed

ERROR Error during SonarScanner Engine execution
java.lang.IllegalStateException: Failed to find all committed files

Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 4d385b7db0bbb3110ccd11f71547a7b7714c73b9

This numbers are the commit hashes.

The checkout for the Maven and the python repo work in the same way. Configuration is completely the same but for some reason the scanner image fails.

And yes I mount the .git folder into the container.

As mentioned in other posts the " 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."
Appears for every pipeline independent of fail or success

Can someone provide my any help on this issue?

Best Regards
Christian

Hi Christian,

Welcome to the community!

Can we have the full analysis log, please?

In fact, could we have a full sonar.verbose=true analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Thx,
Ann

PropertyEncrypter_build_PR_92.log (121.8 KB)

have added the verbose log.

The container running sonarscanner is not able to make calls to our bitbucket server, but this shouldn’t be necessary.

Best Regards
Chris

Hi Chris,

Thanks for the log.

Before the first SCM error, there’s this:

[09:55:52] :	 [Step 3/3] 08:55:52.068 DEBUG Thread[main,5,main]: cannot measure timestamp resolution in read-only directory /usr/src/.git
[09:55:52] :	 [Step 3/3] 08:55:52.070 DEBUG Thread[main,5,main]: cannot measure timestamp resolution in read-only directory /usr/src/.git/objects
[09:55:52] :	 [Step 3/3] 08:55:52.071 DEBUG Thread[main,5,main]: cannot measure timestamp resolution of unborn directory /work/teamcity-agent-data/system/git/git-F072D3BD.git
[09:55:52] :	 [Step 3/3] 08:55:52.072 DEBUG Thread[main,5,main]: cannot measure timestamp resolution in read-only directory /usr/src/.git/objects/pack
[09:55:52] :	 [Step 3/3] 08:55:52.072 DEBUG Thread[main,5,main]: cannot measure timestamp resolution of unborn directory /work/teamcity-agent-data/system/git/git-F072D3BD.git/objects

It’s not clear to me why you would have read-only and unborn directories (branches?) in your workspace, but backing up to the top of the log (thanks for including the whole thing!) it seems that your checkout step is quite elaborate. Could you try this with a plain checkout?

 
Thx,
Ann

What do you mean with plain checkout?

Checkout works in the same way as the other maven projects.

The only thing I could think of is that the user used inside the scanner container has no permission to read the .git files and the user used inside our maven build container is allowed to do this.

But I don’t understand why the user inside the scanner container would be able to run the scan but not to access .git. The files inside the workdirectory are owned all by the same user.

Hi,

I suspect this is not about ownership, but about file permissions:

read-only directory

 
HTH,
Ann