7.7 PR Decoration skipping on multiple organizations

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarqube 7.7.0.23042 ( Enterprise Edition), sonar-maven-plugin:3.5.0.1254
  • what are you trying to achieve
    Trying to do PR decoration on github on multiple organizations
    In the organization that I created the App it works fine and decorates
    But on another organization I get in the ce.log “Could not find a suitable sha1 to decorate, skip decoration.”
  • what have you tried so far to achieve this
    I created an App on a Organization in github and then I installed it on another Organization so that it also decorates the PRs

Just to be clear, it doesn’t matter in which organization the app was created. Wherever it was created, SonarQube must be configured with the credentials of the app, and GitHub repos or organizations that want PR decoration, must install the app, giving it the requested permissions (to create Checks, etc).

The specific warning “Could not find a suitable sha1 to decorate, skip decoration.” can happen when the SHA1 that was analyzed is not the same as the HEAD of the PR. Two common causes:

  • By the time the analysis report is processed by SonarQube, another developer pushed a new commit to the PR. If a push to a PR triggers a new analysis, then you will get eventually correct behavior, simply by waiting.
  • The CI system performs a merge, commits it, and runs an analysis: this local commit is clearly not the same as the HEAD of the PR on GitHub. We don’t yet support well this scenario, and we plan to improve it. Until then, you need to make sure that the CI system analyzes the same commit that as the HEAD of the PR, and not a local merge commit.

Could one of these apply to you? If not, then please tell us more about how you run the analysis, including the CI system, and the configuration of the scanner parameters.

Thanks a lot, it was the second cause.
I was testing with an old PR and Jenkins was performing a merge because the PR wasn’t rebased.
I tried with a “fresh” PR and it worked.
Hope you support this scenario soon, in this case the PR wasn’t that old, only one commit behind and it was possible to merge.

Indeed an improvement on this is coming soon, probably in the 7.8 release. Namely, this ticket:

https://jira.sonarsource.com/browse/SONAR-11950

We are also having this problem, but we don’t match the scenarios explained above. Under what other conditions can this occur? We say here that it can be caused by not having the Git plugin, but we have that. Following is the relevant compute engine log. Notice the second to last entry.

2019.05.28 19:33:16 INFO  ce[][o.s.c.t.CeWorkerImpl] Execute task | project=[key] | type=REPORT | pullRequest=42 | id=AWr_7rOR56Vpqw7AQAAU | submitter=admin
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Extract report | status=SUCCESS | time=252ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist scanner context | status=SUCCESS | time=8ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Propagate analysis warnings from scanner report | status=SUCCESS | time=0ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Execute DB migrations for current project | status=SUCCESS | time=6ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Generate analysis UUID | status=SUCCESS | time=0ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Load analysis metadata | status=SUCCESS | time=92ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Initialize | status=SUCCESS | time=21ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Verify billing | status=SUCCESS | time=0ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Build tree of components | components=1 | status=SUCCESS | time=46ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Validate project | status=SUCCESS | time=6ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Load quality profiles | status=SUCCESS | time=338ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Load Quality gate | status=SUCCESS | time=22ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Load new code period | status=SUCCESS | time=0ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Detect file moves | reportFiles=0 | status=SUCCESS | time=1ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Load duplications | duplications=0 | status=SUCCESS | time=5ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute cross project duplications | status=SUCCESS | time=0ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute size measures | status=SUCCESS | time=4ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute new coverage | status=SUCCESS | time=3ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute coverage measures | status=SUCCESS | time=40ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute comment measures | status=SUCCESS | time=1ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Copy custom measures | status=SUCCESS | time=5ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute duplication measures | status=SUCCESS | time=6ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute duplication data measures | status=SUCCESS | time=0ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute size measures on new code | status=SUCCESS | time=1ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute language distribution | status=SUCCESS | time=7ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute test measures | status=SUCCESS | time=0ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute complexity measures | status=SUCCESS | time=2ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Load measure computers | status=SUCCESS | time=2ms
2019.05.28 19:33:17 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute Quality Profile status | status=SUCCESS | time=5ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Execute component visitors | status=SUCCESS | time=61ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Checks executed after computation of measures | status=SUCCESS | time=15ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute Quality Gate measures | status=SUCCESS | time=13ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Compute Quality profile measures | status=SUCCESS | time=1ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Generate Quality profile events | status=SUCCESS | time=4ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Generate Quality gate events | status=SUCCESS | time=0ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist components | status=SUCCESS | time=25ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist analysis | status=SUCCESS | time=4ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist analysis properties | status=SUCCESS | time=12ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist measures | inserts=50 | status=SUCCESS | time=32ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist live measures | insertsOrUpdates=50 | status=SUCCESS | time=42ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist new ad hoc Rules | status=SUCCESS | time=1ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist issues | inserts=0 | updates=0 | merged=0 | untouched=0 | status=SUCCESS | time=2ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist project links | status=SUCCESS | time=0ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist events | status=SUCCESS | time=36ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist sources | status=SUCCESS | time=4ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Persist cross project duplications | status=SUCCESS | time=0ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Enable analysis | status=SUCCESS | time=10ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Update last usage date of quality profiles | status=SUCCESS | time=0ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Purge db | status=SUCCESS | time=195ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Index analysis | status=SUCCESS | time=46ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Send issue notifications | newIssuesNotifs=0 | newIssuesDeliveries=0 | myNewIssuesNotifs=0 | myNewIssuesDeliveries=0 | changesNotifs=0 | changesDeliveries=0 | status=SUCCESS | time=4ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Publish task results | status=SUCCESS | time=0ms
2019.05.28 19:33:18 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.s.ComputationStepExecutor] Trigger refresh of Portfolios and Applications | status=SUCCESS | time=0ms
2019.05.28 19:33:20 WARN  ce[AWr_7rOR56Vpqw7AQAAU][c.s.C.C.D.L] Could not find a suitable sha1 to decorate, skip decoration.
2019.05.28 19:33:20 INFO  ce[AWr_7rOR56Vpqw7AQAAU][o.s.c.t.CeWorkerImpl] Executed task | project=[key] | type=REPORT | pullRequest=42 | id=AWr_7rOR56Vpqw7AQAAU | submitter=admin | status=SUCCESS | time=3443ms