Pull Request Analysis not displayed under correct branch

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) Sonarqube Enterprise 8.2, 4.2.0.1873
  • what are you trying to achieve
    Scan results displayed under correct long-lived branch
  • what have you tried so far to achieve this
    debug mode, forum searches.

I’m running scans for one of our projects and the scan output for pullrequests against one of our long-lived branches is going under the Master branch instead. This only seems to happen with this one repo and from what I can compare, the command is the same for other repos that work fine.

echo “TRAVIS_PULL_REQUEST: {TRAVIS_PULL_REQUEST}" echo "TRAVIS_PULL_REQUEST_BRANCH: {TRAVIS_PULL_REQUEST_BRANCH}”
echo “TRAVIS_BRANCH: {TRAVIS_BRANCH}" echo "TRAVIS_BUILD_DIR: {TRAVIS_BUILD_DIR}”

{HOME}/sonar-scanner-{SONAR_SCANNER_VERSION}/bin/sonar-scanner -X -Dsonar.projectKey= -Dsonar.sources={TRAVIS_BUILD_DIR}/src -Dsonar.host.url={SONAR_URL} -Dsonar.pullrequest.branch={TRAVIS_PULL_REQUEST_BRANCH} -Dsonar.pullrequest.base={TRAVIS_BRANCH} -Dsonar.pullrequest.key={TRAVIS_PULL_REQUEST} -Dsonar.login={SONAR_LOGIN} -Dsonar.python.coverage.reportPaths=${TRAVIS_BUILD_DIR}/src/coverage.xml -Dsonar.coverage.exclusions=/test,test*/

The Travis branch parameters are pointing to our long-lived branch and not master. However, the results in the UI appear as a pr under master. The actual results look fine. It’s just the location of the pr that’s wrong.

Hi,
So you confirm that echo “TRAVIS_BRANCH: {TRAVIS_BRANCH} is not printing master?
The scanner logs with debug enabled would help us figure it out.