Travis CI sonar-scanner send analysis to unexpected branch


(Elton Lau) #1

i have job running on Travis CI, “development” branch build,
triggering “sonar-scanner” addon command

here 's the properties file:


i am expecting the result is sync to sonarcloud 's “development” branch

but i found “master” branch dashboard got updated.

p.s. it’s a new project, “master” does not have any analysis before

(Fabrice Bellingard) #2

Hi Elton, is development your default branch on GitHub? If yes, then you just need to rename the default branch in SonarCloud (in the “Administration > Branch & Pull Requests” project menu).

(Elton Lau) #3

i would like to keep the default branch on GitHub and SonarCloud different.
my current solution is passing the branch argument “$TRAVIS_BRANCH”
it best if command line tool “sonar-scanner” , can auto detect $TRAVIS_BRANCH , when it’s a branch build on Travis CI

(Fabrice Bellingard) #4

Can you expand on this? What’s the reason?

(Elton Lau) #5

SonarCloud default to display “master” on dashboard, as it’s production version
GitHub default to “development”, as most Pull Requests are targeting it, for developer convenience