]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13259 Fix branch analysis on Travis CI for public repo
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Fri, 27 Mar 2020 12:38:20 +0000 (13:38 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 27 Mar 2020 20:03:28 +0000 (20:03 +0000)
travis.sh

index 56e6158e5e864a2a771f5ee3b6322a85b9903f5d..690b4d8dd3b08ab65ee34d75f78d6034732f4ebc 100755 (executable)
--- a/travis.sh
+++ b/travis.sh
@@ -41,11 +41,20 @@ BUILD)
   # the '-' at the end is needed when using set -u (the 'nounset' flag)
   # see https://stackoverflow.com/a/9824943/641955
   if [[ -n "${SONAR_TOKEN-}" ]]; then
-    ./gradlew jacocoTestReport sonarqube --info --no-daemon --console plain \
-      -Dsonar.projectKey=org.sonarsource.sonarqube:sonarqube \
-      -Dsonar.organization=sonarsource \
-      -Dsonar.host.url=https://sonarcloud.io \
-      -Dsonar.login="$SONAR_TOKEN"
+    if [[ "${TRAVIS_BRANCH}" == "master" ]]; then
+      ./gradlew jacocoTestReport sonarqube --info --no-daemon --console plain \
+        -Dsonar.projectKey=org.sonarsource.sonarqube:sonarqube \
+        -Dsonar.organization=sonarsource \
+        -Dsonar.host.url=https://sonarcloud.io \
+        -Dsonar.login="$SONAR_TOKEN"
+    else
+      ./gradlew jacocoTestReport sonarqube --info --no-daemon --console plain \
+        -Dsonar.projectKey=org.sonarsource.sonarqube:sonarqube \
+        -Dsonar.organization=sonarsource \
+        -Dsonar.host.url=https://sonarcloud.io \
+        -Dsonar.login="$SONAR_TOKEN" \
+        -Dsonar.branch.name="$TRAVIS_BRANCH"
+    fi
   fi
   ;;