Hi i am using aws code build with sonar for bitbucket pull request decoration… but i am not getting any comments on pull request… aws codebuild logs… [sonar4bitbucket] No open pull requests with source branch ‘’ found. No analysis will be performed. … here is my aws code build command … sonar-scanner -Dsonar.branch=$GIT_BRANCH -Dsonar.bitbucket.branchName=$GIT_BRANCH -Dsonar.analysis.mode=issues -Dsonar.bitbucket.oauthClientSecret=secret -Dsonar.bitbucket.oauthClientKey=key -Dsonar.bitbucket.minSeverity=INFO -Dsonar.host.url=my server-url -Dsonar.bitbucket.teamName=teamname -Dsonar.bitbucket.repoSlug=myreponame -Dsonar.bitbucket.accountName=my-account-name -Dsonar.bitbucket.approvalFeatureEnabled=false -Dsonar.bitbucket.buildStatusEnabled=true i think the problem is with these two properties i,e -Dsonar.branch=$GIT_BRANCH -Dsonar.bitbucket.branchName=$GIT_BRANCH but i dont know how to get the values of these from aws code build environmental variables (https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html)
and then passing CODEBUILD_GIT_BRANCH variable to Sonar i,e -Dsonar.branch=$CODEBUILD_GIT_BRANCH -Dsonar.bitbucket.branchName=$CODEBUILD_GIT_BRANCH
so sonar will get Pull request source branch and analyze it and decorate pull request …
here is link for further details …