Pull-Request decoration not happening

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 8.2-developer, sonar-maven-plugin 3.6.0.1398
  • error observed (wrap logs/code around triple quote ``` for proper formatting)
    Warnings:
Could not find ref 'master' in refs/heads or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.
Property 'sonar.jacoco.reportPath' is no longer supported. Use JaCoCo's xml report and sonar-jacoco plugin.
Pull request decoration did not happen. Commit 'c3f9d26eda76c51edf61b311172a91c3dde671a4' not found in pull request '144'
  • steps to reproduce
    Jenkinsfile settings:
            if ( env.CHANGE_BRANCH != null ) {
                sonarOptions = "-Dsonar.pullrequest.branch=${CHANGE_BRANCH}  -Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.pullrequest.key=${CHANGE_ID} "
            }
            else {
                sonarOptions = "-Dsonar.branch.name=${BRANCH_NAME} "
            }

then followed by:

sh "mvn mvn -B -e -Dsonar.host.url=https://sonarqube.example.com  -Dsonar.login=REDACTED ${sonarOptions}  sonar:sonar
  • potential workaround

P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour

Hi,

It’s not clear to me which warnings you think shouldn’t be there.

 
Ann

For one thing (I forgot to point out) the build.gradle contains:

        property "sonar.java.coveragePlugin", "jacoco"
        property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"

So why am I getting the other complaint?
More seriously, the REAL issue is this:

Pull request decoration did not happen. Commit 'c3f9d26eda76c51edf61b311172a91c3dde671a4' not found in pull request '144'

Because this is the exact commit SHA and CHANGE_ID provided by the trigger for the build. I have seen this in other builds. My developers are complaining about this problem and need answers.

Hi,

To be clear, the point of this thread is investigating why PR decoration didn’t happen?

 
Ann

Yes, that too.

Could it be due to 8.2-developer vs. 8.3.1-developer docker images?

Hi,

Sorry, but it really needs to be one topic per thread. Which one would you like to focus on here?

 
Thanks for understanding,
Ann

Let’s focus on the PR decoration; do I need to change topic title? (Did it anyway)

I re-ran the project through SonarQube 8.3.1-DE and got the same results. Maven was invoked with this command: mvn -B -e '-Dsonar.userHome=/home/gradle' '-Dsonar.host.url=https://sonarqube.example.com' '-Dsonar.scm.disabled=true' '-Dsonar.pullrequest.branch=1.7-release' '-Dsonar.pullrequest.base=master' '-Dsonar.pullrequest.key=144' sonar:sonar and resulting analysis produced an error link to this:

Did I miss something here?

Additional error messages appeared following the last analysis:

Could not find ref 'master' in refs/heads, refs/remotes/upstream or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.

Pull request decoration did not happen. Commit 'bcf092a5304cd0a75de68c2aab2556f4c8b387ff' not found in pull request '144'

Creating an analysis summary for GitHub Pull Request has failed. Please check the permission configuration and the connectivity to GitHub.

I’ve been able to understand this now; I have confirmed the workspace contains a .git directory populated from the pull-request commit. But it ONLY contains the PR branch code, labeled PR-<pull #> so I need to revise how Jenkins does the “Discover PR from origin” from “The current pull-request branch” to “Merging the pull-request with the target branch revision” and make sure my setting for “sonar.pullrequest.key=PR-${CHANGE_ID}”

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.