blob: 1df31a7f7a0f29c975fd5d90184a4bcf14d9ef93 [file] [log] [blame]
#!/bin/bash -ex
# exit on errors
set -eu -o pipefail
ONOS_ROOT=`pwd`
. tools/build/envDefaults
PATH=$PATH:/home/jenkins/bin
# download and install Sonar scanner
SONAR_SCANNER_VERSION=3.3.0.1492
curl -L -o /tmp/sonar-scanner-cli.zip -X GET https://central.maven.org/maven2/org/sonarsource/scanner/cli/sonar-scanner-cli/$SONAR_SCANNER_VERSION/sonar-scanner-cli-$SONAR_SCANNER_VERSION.zip
unzip /tmp/sonar-scanner-cli.zip
# Configure ONOS specific properties
echo "sonar.host.url=https://sonar.onosproject.org" >>sonar-scanner-$SONAR_SCANNER_VERSION/conf/sonar-scanner.properties
# Generate coverage data
tools/build/onos-prepare-sonar
# Upload coverage to Sonar
cd bazel-genfiles/sonar-project && $ONOS_ROOT/sonar-scanner-$SONAR_SCANNER_VERSION/bin/sonar-scanner