PR decoration in GitHub-Jenkins pipeline(single-branch) it’s not working. It’s just commenting the URL of the SonarQube in the pull request. The code I attached below for your reference
stage('Send report to GitHub PR') {
steps {
script {
def prNumber = 2
def githubPrComment = sh(script: """
curl -H 'Authorization: token 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' -X POST -d '{"body":"[SonarQube Analysis Report](${SONARQUBE_URL})"}' https://api.github.com/repos/msdvc-sandbox1/new-repo/issues/$prNumber/comments
""", returnStatus: true)
if (githubPrComment == 0) {
echo 'SonarQube analysis report sent to GitHub PR successfully'
} else {
error 'Failed to send SonarQube analysis report to GitHub PR'
}
}
}
}
the report i am getting while executing the pipeline is attached below
Hey, There is a document for pr decoration using multibranch pipeline.is there any way we can achieve this in normal pipeline in Jenkins? If it is then please share me the link. I have surfed all through the internet didn’t find it.
Or if any web API that displays exactly like a pr decoration like
Bugs-0
vulnerabilties-1
code smell-0
coverage-0
Duplications-1
I have tried many web API’s but none of this come like this. Please this a high priority task any lead would much helpful Ann Campbell
Since you’re on a current, commercial version, the functionality is available to you. You just need to configure it properly. I urge you to review the docs I linked earlier, and perhaps also these.
This time I have configured it perfectly. but in the analysis warnings i have got error like this ''Failed to report status to DevOps platform because the configured repository slug does not have the expected format ‘organization/repository’ " , But the DevOps platform integration shows configuration is valid I attached the screenshot for your reference