Hi,
We recently started using SonarQube to analyze our project built with Azure DevOps and using the branch feature.
-
versions used
Developer Edition (7.9.0.26994)
Azure DevOps tasks are version 4.* which turns out to be 4.6.3. -
error observed
When building the master branch (actually the default branch configured in DevOps) or some specific branches, the project is analyzed and results show up (also as a branch if that is the case).
However, for some other branches, this is not the case and the results are not shown.
In that case, the error (from DevOps) is:
[SQ] Task failed with status FAILED, Error message: Compute Engine task main component key is null. Project with UUID AWvBds-6mJnVjF3DJ_EA must have been deleted since report was uploaded. Can not proceed.
Looking at the log files on the SonarQube server, shows the following:
Branch that fails, access.log:
[16/Jul/2019:08:17:07 +0000] "POST /api/ce/submit?projectKey=sonar.supermodels&projectName=supermodels&characteristic=branch%3Dfeature%2FTC3State&characteristic=branchType%3DSHORT HTTP/1.1" 200 44 "-" "ScannerCli/3.3.0.1492" "AWvRS53FaUsW/ncwABjx"
Branch that fails, ce.log:
2019.07.16 08:17:09 INFO ce[][o.s.c.t.CeWorkerImpl] Execute task | type=REPORT | branch=feature/TC3State | branchType=SHORT | id=AWv520zfRQdbPXa-C3g- | submitter=admin
2019.07.16 08:17:09 INFO ce[AWv520zfRQdbPXa-C3g-][o.s.c.t.s.ComputationStepExecutor] Extract report | status=SUCCESS | time=424ms
2019.07.16 08:17:09 INFO ce[AWv520zfRQdbPXa-C3g-][o.s.c.t.s.ComputationStepExecutor] Persist scanner context | status=SUCCESS | time=19ms
2019.07.16 08:17:09 INFO ce[AWv520zfRQdbPXa-C3g-][o.s.c.t.s.ComputationStepExecutor] Propagate analysis warnings from scanner report | status=SUCCESS | time=0ms
2019.07.16 08:17:09 INFO ce[AWv520zfRQdbPXa-C3g-][o.s.c.t.s.ComputationStepExecutor] Execute DB migrations for current project | status=SUCCESS | time=1ms
2019.07.16 08:17:09 INFO ce[AWv520zfRQdbPXa-C3g-][o.s.c.t.s.ComputationStepExecutor] Generate analysis UUID | status=SUCCESS | time=1ms
2019.07.16 08:17:09 INFO ce[AWv520zfRQdbPXa-C3g-][o.s.c.t.s.ComputationStepExecutor] Load analysis metadata | status=FAILED | time=3ms
2019.07.16 08:17:09 ERROR ce[AWv520zfRQdbPXa-C3g-][o.s.c.t.s.ComputationStepExecutor] Execution of listener failed
java.lang.IllegalStateException: Missing project key
at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.lambda$createProject$1(PostProjectAnalysisTasksExecutor.java:154)
(...)
at java.base/java.lang.Thread.run(Thread.java:834)
2019.07.16 08:17:09 INFO ce[AWv520zfRQdbPXa-C3g-][o.s.c.t.CeWorkerImpl] Executed task | type=REPORT | branch=feature/TC3State | branchType=SHORT | id=AWv520zfRQdbPXa-C3g- | submitter=admin | status=FAILED | time=624ms
Branch that succeeds, access.log:
[16/Jul/2019:09:08:11 +0000] "POST /api/ce/submit?projectKey=sonar.supermodels&projectName=supermodels&characteristic=branch%3DFeature%2FRoslyn&characteristic=branchType%3DSHORT HTTP/1.1" 200 44 "-" "ScannerCli/3.3.0.1492" "AWvRS53FaUsW/ncwABks"
Branch that succeeds, ce.log:
2019.07.16 09:08:12 INFO ce[][o.s.c.t.CeWorkerImpl] Execute task | project=sonar.supermodels | type=REPORT | branch=Feature/Roslyn | branchType=SHORT | id=AWv6CgvqRQdbPXa-C3hC | submitter=admin
2019.07.16 09:08:13 INFO ce[AWv6CgvqRQdbPXa-C3hC][o.s.c.t.s.ComputationStepExecutor] Extract report | status=SUCCESS | time=385ms
2019.07.16 09:08:13 INFO ce[AWv6CgvqRQdbPXa-C3hC][o.s.c.t.s.ComputationStepExecutor] Persist scanner context | status=SUCCESS | time=12ms
2019.07.16 09:08:13 INFO ce[AWv6CgvqRQdbPXa-C3hC][o.s.c.t.s.ComputationStepExecutor] Propagate analysis warnings from scanner report | status=SUCCESS | time=0ms
2019.07.16 09:08:13 INFO ce[AWv6CgvqRQdbPXa-C3hC][o.s.c.t.s.ComputationStepExecutor] Execute DB migrations for current project | status=SUCCESS | time=2ms
2019.07.16 09:08:13 INFO ce[AWv6CgvqRQdbPXa-C3hC][o.s.c.t.s.ComputationStepExecutor] Generate analysis UUID | status=SUCCESS | time=0ms
2019.07.16 09:08:13 INFO ce[AWv6CgvqRQdbPXa-C3hC][o.s.c.t.s.ComputationStepExecutor] Load analysis metadata | status=SUCCESS | time=12ms
2019.07.16 09:08:13 INFO ce[AWv6CgvqRQdbPXa-C3hC][o.s.c.t.s.ComputationStepExecutor] Initialize | status=SUCCESS | time=3ms
(...)
2019.07.16 09:08:36 INFO ce[AWv6CgvqRQdbPXa-C3hC][o.s.c.t.CeWorkerImpl] Executed task | project=sonar.supermodels | type=REPORT | branch=Feature/Roslyn | branchType=SHORT | id=AWv6CgvqRQdbPXa-C3hC | submitter=admin | status=SUCCESS | time=23659ms
It can be seen the project key is missing in the compute engine log for the failing case, but why this happens is not clear since in both cases the project key is present in the API call as can be seen in access.log. There are more branches that either succeed or fail than listed here. I’ve not been able to identify what causes some to work and others not.
-
steps to reproduce
As mentioned, we are using Azure DevOps to build, using the standard SonarQube tasks (Prepare Analysis Configuration, Run Code Analysis, Publish Quality Gate Result). So the builds that are working and the builds that are not working are executed exactly the same way, except that they are different branches. If the analysis fails, the Publish Quality Gate Result step also fails (project cannot be found).
The problem reproduces each time for specific branches (so if a branch analysis fails to execute, it fails each time; if it succeeds, it succeeds each time). -
potential workaround
None found
Any help would be appreciated.