Sonarqube New Code Analysis is always empty

Sonarqube developer version: 8.2.0.32929

We are trying to get New Code analysis done on Pull Request branches. I have read the fixing the water leak article as well as the concepts of Long-Lived Branches and Short-Lived Branches

I wanted to ask if fundamentally the following is possible in Sonarqube. When a pull request is created on a specific branch say feature/aa targeting master, can we see the code analysis done on only the new code which was added in the branch?

We have tried this by doing the following –

  • Doing a normal branch analysis with following args -
    sonar-scanner
    -Dsonar.pullrequest.key={PULL_REQUEST_NUMBER} \ -Dsonar.pullrequest.branch=PR-{PULL_REQUEST_NUMBER}
    -Dsonar.pullrequest.base=${PULL_REQUEST_BASE_REF}
  • Created a rule for long running branches with feature/* rule and created a PR with a branch name of feature/sonarqube-test added some minor issues and created the PR. Even in this case, the new code doesn’t show

We always end up seeing an image like following –

It’s odd that you have PULL_REQUEST_NUMBER as both the variable for sonar.pullrequest.key and sonar.pullrequest.branch.

The latter (sonar.pullrequest.branch) should be equivalent to the name of the branch you want to merge into the branch defined by sonar.pullrequest.base.

I would expect the detection of changed files/lines to work better if that is resolved.

Out of curiosity, what CI tool are you typically using? These parameters should be auto-configured in many cases, which is much less error prone.

1 Like

The branch is actually PR-{PULL_REQUEST_NUMBER} and this seems to be populated just fine actual branch analysis. I can also navigate from the branch analysis to actual PR in GitHub.

Regarding CI tool, we use Jenkins pipeline for CI and pass these params as part of a build pipeline. Let me know if there is a better way to do this.

Here is the screenshot for the branch information for the analysis above.

Hi Colin it seems to work fine for the branch name, seems to be loaded just fine in the Sonar UI as well. The parameters being passed are something on the lines of –

-Dsonar.pullrequest.key=2000 \ 
-Dsonar.pullrequest.branch=PR-2000 \ 
-Dsonar.pullrequest.base=master

I’m having the same issue. The branch analysis is working as expected but the PR analysis is empty.

Since you’re using Jenkins, I’d highly recommend upgrading to 8.3 where these parameters are auto configured.

I’m a bit skeptical about this. In your original post you mentioned feature/sonarqube-test as the branch. This is the value I’d expect to be used for the branch parameter. I could be wrong, but I’m not sure how the detection of new code works if it’s a secondary “merge” branch.

Any other clues would probably be in your analysis logs (with DEBUG logging enabled. Usually achieved by appending ‘-X’ to the scan command). You can attach them in a post on this topic. Specifically, log messages like this are meaningful.

13:55:10 - 08:25:10.540 INFO: Pull request 455 for merge into master-branch from pr-branch
13:55:10 - 08:25:10.552 INFO: SCM collecting changed files in the branch
13:55:10 - 08:25:10.611 DEBUG: readpipe [git, --version],/usr/bin
13:55:10 - 08:25:10.623 DEBUG: readpipe may return ‘git version 2.9.3’
13:55:10 - 08:25:10.623 DEBUG: remaining output:
13:55:10 -
13:55:10 - 08:25:10.623 DEBUG: readpipe [git, config, --system, --edit],/usr/bin
13:55:10 - 08:25:10.626 DEBUG: readpipe may return ‘/etc/gitconfig’
13:55:10 - 08:25:10.626 DEBUG: remaining output:
13:55:10 -
13:55:10 - 08:25:10.744 DEBUG: Merge base sha1: 8888888888888888888
13:55:10 - 08:25:10.768 INFO: SCM collecting changed files in the branch (done) | time=216ms
**13:55:10 - 08:25:10.768 DEBUG: SCM reported 0 files changed in the branch**

I’d recommend starting a new thread with more details. Troubleshooting multiple, even related, problems on one community post is messy :slight_smile:

Hi Colin, I was able to update the sonar server to 8.3. But I am not seeing any changes in the analysis. I enabled debug logs like you suggested and I am seeing logs like you mentioned -

[2020-05-27T16:40:35.766Z] 16:40:35.559 INFO: Pull request 3756 for merge into master from PR-3756
[2020-05-27T16:40:35.766Z] 16:40:35.589 INFO: SCM collecting changed files in the branch
[2020-05-27T16:40:35.766Z] 16:40:35.616 DEBUG: file=<workspace>/.git/config, create new FileSnapshot: lastRead=2020-05-27 16:40:35.614000000, lastModified=2020-05-27 16:40:31.397891000, size=199, fileKey=(dev=10302,ino=64256003)
[2020-05-27T16:40:35.766Z] 16:40:35.620 DEBUG: file=null, size changed from -1 to 146 bytes
[2020-05-27T16:40:35.766Z] 16:40:35.620 DEBUG: loading config FileBasedConfig[/root/.config/jgit/config]
[2020-05-27T16:40:35.766Z] 16:40:35.621 DEBUG: file=/root/.config/jgit/config, create new FileSnapshot: lastRead=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, size=146, fileKey=(dev=34,ino=80656636)
[2020-05-27T16:40:35.766Z] 16:40:35.622 DEBUG: readpipe [git, --version],/usr/bin
[2020-05-27T16:40:35.766Z] 16:40:35.654 DEBUG: readpipe may return 'git version 2.17.1'
[2020-05-27T16:40:35.766Z] 16:40:35.654 DEBUG: remaining output:
[2020-05-27T16:40:35.766Z] 
[2020-05-27T16:40:35.766Z] 16:40:35.655 DEBUG: readpipe [git, config, --system, --edit],/usr/bin
[2020-05-27T16:40:35.766Z] 16:40:35.659 DEBUG: readpipe may return '/etc/gitconfig'
[2020-05-27T16:40:35.766Z] 16:40:35.659 DEBUG: remaining output:
[2020-05-27T16:40:35.766Z] 
[2020-05-27T16:40:35.766Z] 16:40:35.659 DEBUG: file=/root/.config/jgit/config, isRacyClean=false, read=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, delta=85717130992000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.766Z] 16:40:35.659 DEBUG: file=/root/.config/jgit/config, is unmodified
[2020-05-27T16:40:35.766Z] 16:40:35.660 DEBUG: file=null, size changed from -1 to 0 bytes
[2020-05-27T16:40:35.767Z] 16:40:35.660 DEBUG: loading config FileBasedConfig[/etc/gitconfig]
[2020-05-27T16:40:35.767Z] 16:40:35.660 DEBUG: file=/root/.config/jgit/config, isRacyClean=false, read=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, delta=85717130992000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.660 DEBUG: file=/root/.config/jgit/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.660 DEBUG: file=/etc/gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=1970-01-01 00:00:00.000000000, delta=1590597635660000000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.660 DEBUG: file=/etc/gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.660 DEBUG: file=null, size changed from -1 to 48 bytes
[2020-05-27T16:40:35.767Z] 16:40:35.660 DEBUG: loading config FileBasedConfig[/root/.gitconfig]
[2020-05-27T16:40:35.767Z] 16:40:35.660 DEBUG: file=/root/.gitconfig, create new FileSnapshot: lastRead=2020-05-27 16:40:35.660000000, lastModified=2020-05-27 16:40:31.709893000, size=48, fileKey=(dev=34,ino=80646929)
[2020-05-27T16:40:35.767Z] 16:40:35.661 DEBUG: file=<workspace>/.git/config, create new FileSnapshot: lastRead=2020-05-27 16:40:35.661000000, lastModified=2020-05-27 16:40:31.397891000, size=199, fileKey=(dev=10302,ino=64256003)
[2020-05-27T16:40:35.767Z] 16:40:35.662 DEBUG: file=/root/.config/jgit/config, isRacyClean=false, read=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, delta=85717130992000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.662 DEBUG: file=/root/.config/jgit/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.662 DEBUG: file=/etc/gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=1970-01-01 00:00:00.000000000, delta=1590597635660000000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.662 DEBUG: file=/etc/gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.663 DEBUG: file=/root/.gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=2020-05-27 16:40:31.709893000, delta=3950107000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.663 DEBUG: file=/root/.gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.663 DEBUG: file=<workspace>/.git/config, isRacyClean=false, read=2020-05-27 16:40:35.661000000, lastModified=2020-05-27 16:40:31.397891000, delta=4263109000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.663 DEBUG: file=<workspace>/.git/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.694 DEBUG: file=/root/.config/jgit/config, isRacyClean=false, read=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, delta=85717130992000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.694 DEBUG: file=/root/.config/jgit/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.694 DEBUG: file=/etc/gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=1970-01-01 00:00:00.000000000, delta=1590597635660000000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.694 DEBUG: file=/etc/gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.695 DEBUG: file=/root/.gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=2020-05-27 16:40:31.709893000, delta=3950107000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.695 DEBUG: file=/root/.gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.696 DEBUG: file=<workspace>/.git/index, create new FileSnapshot: lastRead=2020-05-27 16:40:35.683000000, lastModified=2020-05-27 16:40:33.173906000, size=3907090, fileKey=(dev=10302,ino=64256020)
[2020-05-27T16:40:35.767Z] 16:40:35.696 DEBUG: file=/root/.config/jgit/config, isRacyClean=false, read=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, delta=85717130992000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.696 DEBUG: file=/root/.config/jgit/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.696 DEBUG: file=/etc/gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=1970-01-01 00:00:00.000000000, delta=1590597635660000000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.696 DEBUG: file=/etc/gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.696 DEBUG: file=/root/.gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=2020-05-27 16:40:31.709893000, delta=3950107000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.696 DEBUG: file=/root/.gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.696 DEBUG: file=<workspace>/.git/config, isRacyClean=false, read=2020-05-27 16:40:35.661000000, lastModified=2020-05-27 16:40:31.397891000, delta=4263109000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.696 DEBUG: file=<workspace>/.git/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.697 DEBUG: file=<workspace>/.git/refs/heads/master, create new FileSnapshot: lastRead=2020-05-27 16:40:35.696000000, lastModified=2020-05-27 16:40:33.177906000, size=41, fileKey=(dev=10302,ino=64256023)
[2020-05-27T16:40:35.767Z] 16:40:35.698 DEBUG: file=/root/.config/jgit/config, isRacyClean=false, read=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, delta=85717130992000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.698 DEBUG: file=/root/.config/jgit/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.698 DEBUG: file=/etc/gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=1970-01-01 00:00:00.000000000, delta=1590597635660000000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.698 DEBUG: file=/etc/gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.699 DEBUG: file=/root/.gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=2020-05-27 16:40:31.709893000, delta=3950107000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.699 DEBUG: file=/root/.gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.699 DEBUG: file=<workspace>/.git/config, isRacyClean=false, read=2020-05-27 16:40:35.661000000, lastModified=2020-05-27 16:40:31.397891000, delta=4263109000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.699 DEBUG: file=<workspace>/.git/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.723 DEBUG: file=/root/.config/jgit/config, isRacyClean=false, read=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, delta=85717130992000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.724 DEBUG: file=/root/.config/jgit/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.724 DEBUG: file=/etc/gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=1970-01-01 00:00:00.000000000, delta=1590597635660000000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.724 DEBUG: file=/etc/gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.724 DEBUG: file=/root/.gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=2020-05-27 16:40:31.709893000, delta=3950107000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.724 DEBUG: file=/root/.gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.725 DEBUG: file=/root/.config/jgit/config, isRacyClean=false, read=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, delta=85717130992000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.725 DEBUG: file=/root/.config/jgit/config, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.725 DEBUG: file=/etc/gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=1970-01-01 00:00:00.000000000, delta=1590597635660000000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.725 DEBUG: file=/etc/gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.725 DEBUG: file=/root/.gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=2020-05-27 16:40:31.709893000, delta=3950107000 ns, racy<=2500000000 ns
[2020-05-27T16:40:35.767Z] 16:40:35.725 DEBUG: file=/root/.gitconfig, is unmodified
[2020-05-27T16:40:35.767Z] 16:40:35.732 DEBUG: file=null, size changed from -1 to 4096 bytes
[2020-05-27T16:40:35.767Z] 16:40:35.732 DEBUG: file=<workspace>/.git/objects/pack, create new FileSnapshot: lastRead=2020-05-27 16:40:35.732000000, lastModified=2020-05-27 04:12:55.253583000, size=4096, fileKey=(dev=10302,ino=64267738)
[2020-05-27T16:40:35.767Z] 16:40:35.737 DEBUG: file=<workspace>/.git/objects/pack/pack-67b5653c768c3636d01d6c781aed9b802f8e1ed8.pack, create new FileSnapshot: lastRead=2020-05-27 16:40:35.736000000, lastModified=2020-05-27 16:40:33.000000000, size=1411923032, fileKey=(dev=10302,ino=64267745)
[2020-05-27T16:40:35.767Z] 16:40:35.737 DEBUG: file=<workspace>/.git/objects/pack/pack-4acaa7be6d34931e3442a4df5739c3f23ba1fe9d.pack, create new FileSnapshot: lastRead=2020-05-27 16:40:35.737000000, lastModified=2020-05-27 16:40:33.000000000, size=68515, fileKey=(dev=10302,ino=64277770)
[2020-05-27T16:40:35.767Z] 16:40:35.737 DEBUG: file=<workspace>/.git/objects/pack/pack-896c291ac7269c1fb2b241c533337a63b93e34bd.pack, create new FileSnapshot: lastRead=2020-05-27 16:40:35.737000000, lastModified=2020-05-27 16:40:33.000000000, size=126303, fileKey=(dev=10302,ino=64279639)
[2020-05-27T16:40:35.767Z] 16:40:35.737 DEBUG: file=<workspace>/.git/objects/pack/pack-a9976090065f018e519c001aac001645f330016c.pack, create new FileSnapshot: lastRead=2020-05-27 16:40:35.737000000, lastModified=2020-05-27 16:40:33.000000000, size=98971, fileKey=(dev=10302,ino=64279616)
[2020-05-27T16:40:35.767Z] 16:40:35.737 DEBUG: file=<workspace>/.git/objects/pack/pack-ae920801cf07c49f91add6c64f04081b20746738.pack, create new FileSnapshot: lastRead=2020-05-27 16:40:35.737000000, lastModified=2020-05-27 16:40:33.000000000, size=123351, fileKey=(dev=10302,ino=64279594)
[2020-05-27T16:40:36.024Z] 16:40:35.839 DEBUG: Opening pack index <workspace>/.git/objects/pack/pack-67b5653c768c3636d01d6c781aed9b802f8e1ed8.idx, size 37.509 MB took 98 ms
[2020-05-27T16:40:36.024Z] 16:40:35.839 DEBUG: Opening pack index <workspace>/.git/objects/pack/pack-4acaa7be6d34931e3442a4df5739c3f23ba1fe9d.idx, size 0.005 MB took 0 ms
[2020-05-27T16:40:36.024Z] 16:40:35.840 DEBUG: Opening pack index <workspace>/.git/objects/pack/pack-896c291ac7269c1fb2b241c533337a63b93e34bd.idx, size 0.005 MB took 0 ms
[2020-05-27T16:40:36.024Z] 16:40:35.841 DEBUG: Opening pack index <workspace>/.git/objects/pack/pack-a9976090065f018e519c001aac001645f330016c.idx, size 0.005 MB took 1 ms
[2020-05-27T16:40:36.024Z] 16:40:35.842 DEBUG: Opening pack index <workspace>/.git/objects/pack/pack-ae920801cf07c49f91add6c64f04081b20746738.idx, size 0.011 MB took 1 ms
[2020-05-27T16:40:36.024Z] 16:40:35.842 DEBUG: file=<workspace>/.git/objects/pack, isRacyClean=false, read=2020-05-27 16:40:35.732000000, lastModified=2020-05-27 04:12:55.253583000, delta=44860478417000 ns, racy<=14992500 ns
[2020-05-27T16:40:36.024Z] 16:40:35.842 DEBUG: file=<workspace>/.git/objects/pack, is unmodified
[2020-05-27T16:40:36.024Z] 16:40:35.846 DEBUG: file=/root/.config/jgit/config, isRacyClean=false, read=2020-05-27 16:40:35.620000000, lastModified=2020-05-26 16:51:58.489008000, delta=85717130992000 ns, racy<=2500000000 ns
[2020-05-27T16:40:36.024Z] 16:40:35.846 DEBUG: file=/root/.config/jgit/config, is unmodified
[2020-05-27T16:40:36.024Z] 16:40:35.847 DEBUG: file=/etc/gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=1970-01-01 00:00:00.000000000, delta=1590597635660000000 ns, racy<=2500000000 ns
[2020-05-27T16:40:36.024Z] 16:40:35.848 DEBUG: file=/etc/gitconfig, is unmodified
[2020-05-27T16:40:36.024Z] 16:40:35.848 DEBUG: file=/root/.gitconfig, isRacyClean=false, read=2020-05-27 16:40:35.660000000, lastModified=2020-05-27 16:40:31.709893000, delta=3950107000 ns, racy<=2500000000 ns
[2020-05-27T16:40:36.024Z] 16:40:35.848 DEBUG: file=/root/.gitconfig, is unmodified
[2020-05-27T16:40:36.024Z] 16:40:35.848 DEBUG: file=<workspace>/.git/config, isRacyClean=false, read=2020-05-27 16:40:35.661000000, lastModified=2020-05-27 16:40:31.397891000, delta=4263109000 ns, racy<=2500000000 ns
[2020-05-27T16:40:36.024Z] 16:40:35.848 DEBUG: file=<workspace>/.git/config, is unmodified
[2020-05-27T16:40:36.024Z] 16:40:35.849 DEBUG: file=<workspace>/.git/HEAD, create new FileSnapshot: lastRead=2020-05-27 16:40:35.848000000, lastModified=2020-05-27 16:40:31.581892000, size=23, fileKey=(dev=10302,ino=64256006)
[2020-05-27T16:40:36.024Z] 16:40:35.850 DEBUG: file=<workspace>/.git/refs/heads/master, isRacyClean=false, read=2020-05-27 16:40:35.696000000, lastModified=2020-05-27 16:40:33.177906000, delta=2518094000 ns, racy<=14992500 ns
[2020-05-27T16:40:36.024Z] 16:40:35.850 DEBUG: file=<workspace>/.git/refs/heads/master, is unmodified
[2020-05-27T16:40:36.024Z] 16:40:35.851 DEBUG: file=<workspace>/.git/objects/pack, isRacyClean=false, read=2020-05-27 16:40:35.732000000, lastModified=2020-05-27 04:12:55.253583000, delta=44860478417000 ns, racy<=14992500 ns
[2020-05-27T16:40:36.024Z] 16:40:35.851 DEBUG: file=<workspace>/.git/objects/pack, is unmodified
[2020-05-27T16:40:36.024Z] 16:40:35.851 DEBUG: file=<workspace>/.git/objects/pack, isRacyClean=false, read=2020-05-27 16:40:35.732000000, lastModified=2020-05-27 04:12:55.253583000, delta=44860478417000 ns, racy<=14992500 ns
[2020-05-27T16:40:36.024Z] 16:40:35.852 DEBUG: file=<workspace>/.git/objects/pack, is unmodified
[2020-05-27T16:40:36.024Z] 16:40:35.852 DEBUG: Merge base sha1: 8888888888888888888

I see 2 main things of importance which I would like to point out -
[2020-05-27T16:40:36.024Z] 16:40:35.879 DEBUG: SCM reported 0 files changed in the branch
[2020-05-27T16:40:35.512Z] 16:40:35.348 INFO: Found manual configuration of branch/PR analysis. Skipping automatic configuration.

Very important stuff! :slight_smile:

Let me suggest first removing any manual configuration you’ve done (the configuration of sonar.pullrequest.*). This will allow auto-configuration of those properties to kick in.

Out of curiosity, is there evidence earlier in the logs that there are files actually being analyzed?

I tried by removing the params like you suggested –

<workspace>/SonarQube-Scanner-4.3/bin/sonar-scanner -X -Dsonar.sourceEncoding=UTF-8 -Dsonar.projectKey=<project-key> -Dsonar.projectVersion=2998 -Dsonar.scm.revision=8888888888888888888

which got populated from –

${scannerHome}/bin/sonar-scanner -X \
                -Dsonar.sourceEncoding=UTF-8 \
                -Dsonar.projectKey=<project-key> \
                -Dsonar.projectVersion=${params.BUILD_NUMBER} \
                -Dsonar.scm.revision=${params.PULL_PULL_SHA}

This did not end up doing a PR analysis. It ended up on the master branch. I also do not see any logs of the following kind –
[2020-05-27T16:40:35.766Z] 16:40:35.559 INFO: Pull request 3756 for merge into master from PR-3756
[2020-05-27T16:40:35.766Z] 16:40:35.589 INFO: SCM collecting changed files in the branch
[2020-05-27T16:40:36.024Z] 16:40:35.879 DEBUG: SCM reported 0 files changed in the branch
[2020-05-27T16:40:36.024Z] 16:40:35.852 DEBUG: Merge base sha1: 8888888888888888888

Regarding analysis, I see logs for thousands of files which are –
[2020-05-27T17:33:02.190Z] 17:33:01.880 DEBUG: 'filename' indexed with language 'kotlin'

Hm.

Is there a chance that you’re using Jenkins X? I couldn’t find a reference to any of the environment variables you’re using (like PULL_PULL_SHA) except in reference to Jenkins X. Unfortunately, there we don’t support the automatic configuration of pull requests (only with traditional Jenkins).

If you are using traditional Jenkins, I’m very curious how it’s setup because it seems… atypical.

I’ve sent you a private message to see if you can provide the full logs privately. I feel like we’re missing some context and without it, we’ll just keep blindly trying things.

@apar is the issue fixed for you ? if yes what was the solution ?