Duplicated branches in sonarQube dashboard

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

version:

  • Enterprise Edition
  • Version 8.9.9

Question:

  • After finishing soanrQube setting, like pulling sonar scanner in docker image when buiding project, then I crearted a branch for testing, I will see there are two branches in sonarQube fashboard, one Branchname, the other one is Branchname~1, I have no idea where does the second one come from, how can I avoid it?
    image

the following is my configuration in buildspec:

Scan the code with SonarQube

  # Adding the property dynamically to avoid causing issues to GPS checks
  - |
    printf '\n%s\n' 'sonar.qualitygate.wait=true' >> sonar-project.properties  
    if [ $GIT_BRANCH = "master" ]; then
      docker run -v $(pwd):/usr/src -e SONAR_LOGIN=$SONAR_LOGIN $SONAR_SCANNER -Dsonar.projectVersion=1.0.$CODEBUILD_BUILD_NUMBER
    else
      docker run -v $(pwd):/usr/src -e SONAR_LOGIN=$SONAR_LOGIN $SONAR_SCANNER -Dsonar.projectVersion=1.0.$CODEBUILD_BUILD_NUMBER -Dsonar.branch.name=$GIT_BRANCH
    fi

Hi,

We use the name provided during analysis, so the origin of this split is earlier in your pipeline. Unfortunately, I’m not sure where to tell you to look. This looks a bit to me like the automatic name variation that e.g. you get when you download the same document twice. So I would look in your pipeline for any kind of rename-vs-replace behavior.

I know that’s not terribly helpful, but it’s the best I’ve got.

 
Ann