X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;ds=sidebyside;f=shell%2Fcmake-sonar.sh;h=e64ca69cf83803f80640dcff040565ca9557b67d;hb=a86c6e8d376c95aa00b179fce9d207e61c8f72d0;hp=cd7ee71561cba183b54ede71ab6f40f60c0d28fc;hpb=7e66b111c22dec7fc341d593d33b74b4ca9d724b;p=releng%2Fglobal-jjb.git diff --git a/shell/cmake-sonar.sh b/shell/cmake-sonar.sh index cd7ee715..e64ca69c 100644 --- a/shell/cmake-sonar.sh +++ b/shell/cmake-sonar.sh @@ -20,15 +20,21 @@ make_opts="${MAKE_OPTS:-}" set -ex -o pipefail +export SET_JDK_VERSION="${SET_JDK_VERSION:-openjdk11}" +echo "$SET_JDK_VERSION" +bash <(curl -s https://raw.githubusercontent.com/lfit/releng-global-jjb/master/shell/update-java-alternatives.sh) +# shellcheck disable=SC1091 +source /tmp/java.env + cd /tmp || exit 1 -wget -O /tmp/sonar-scan.zip \ +wget -q -O /tmp/sonar-scan.zip \ "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip" -unzip sonar-scan.zip +unzip -q sonar-scan.zip sudo mv sonar-scanner-* /opt/sonar-scanner -wget -O /tmp/bw.zip \ +wget -q -O /tmp/bw.zip \ "https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip" -unzip bw.zip +unzip -q bw.zip sudo mv build-wrapper-* /opt/build-wrapper mkdir -p "$build_dir" @@ -37,13 +43,15 @@ cd "$build_dir" || exit 1 # shellcheck disable=SC2086 eval cmake -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" $cmake_opts .. +# $make_opts may be empty. +# shellcheck disable=SC2086 /opt/build-wrapper/build-wrapper-linux-x86-64 --out-dir "$WORKSPACE/bw-output" \ make $make_opts /opt/sonar-scanner/bin/sonar-scanner \ - -Dsonar.projectKey=${PROJECT_KEY} \ - -Dsonar.organization=${PROJECT_ORGANIZATION} \ + -Dsonar.projectKey="${PROJECT_KEY}" \ + -Dsonar.organization="${PROJECT_ORGANIZATION}" \ -Dsonar.sources=. \ -Dsonar.cfamily.build-wrapper-output="$WORKSPACE/bw-output" \ - -Dsonar.host.url=${SONAR_HOST_URL} \ - -Dsonar.login=${API_TOKEN} + -Dsonar.host.url="${SONAR_HOST_URL}" \ + -Dsonar.login="${API_TOKEN}"