X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fmaven-sonar.sh;h=9af6e427be4fd21b69f7946d709e8b3499890252;hb=a86c6e8d376c95aa00b179fce9d207e61c8f72d0;hp=9e00d2180e1c04774c941940e0ab13dbfac0e343;hpb=09979e2fde9b92aa7bc00de4175a88d64fe9e33f;p=releng%2Fglobal-jjb.git diff --git a/shell/maven-sonar.sh b/shell/maven-sonar.sh index 9e00d218..9af6e427 100644 --- a/shell/maven-sonar.sh +++ b/shell/maven-sonar.sh @@ -34,6 +34,16 @@ if [ "$SONAR_HOST_URL" = "https://sonarcloud.io" ]; then params+=("-Dsonar.projectKey=$PROJECT_KEY") params+=("-Dsonar.organization=$PROJECT_ORGANIZATION") params+=("-Dsonar.login=$API_TOKEN") + if $SCAN_DEV_BRANCH; then + echo "Will scan short lived branch ..." + # shellcheck disable=SC2236 + if [ ! -z ${GERRIT_CHANGE_NUMBER+x} ]; then + GERRIT_SHORT_LIVED_BRANCH=${GERRIT_CHANGE_NUMBER}-${GERRIT_PATCHSET_NUMBER} + params+=("-Dsonar.analysis.gerritProjectName=$PROJECT") + params+=("-Dsonar.branch.target=$GERRIT_BRANCH") + params+=("-Dsonar.branch.name=$GERRIT_SHORT_LIVED_BRANCH") + fi + fi fi if [ "$SET_JDK_VERSION" != "$SONARCLOUD_JAVA_VERSION" ]; then