blob: 57fc34445b18fdddefad2381faf92a9525fad523 [file] [log] [blame]
Ray Milkey20d22522017-11-08 10:55:52 -08001#!/bin/bash -ex
Ray Milkeycb569c32017-12-12 13:42:20 -08002
3# exit on errors
4set -eu -o pipefail
5
Ray Milkey20d22522017-11-08 10:55:52 -08006ONOS_ROOT=`pwd`
7. tools/build/envDefaults
8
Ray Milkey10b96472018-11-21 13:31:06 -08009PATH=$PATH:/home/jenkins/bin
10
Ray Milkeyfaa66c92017-11-08 12:58:43 -080011# download and install Sonar scanner
Ray Milkey7d9c0362019-01-25 13:06:15 -080012SONAR_SCANNER_VERSION=3.3.0.1492
Ray Milkey96246bc2020-01-24 10:21:29 -080013curl -L -o /tmp/sonar-scanner-cli.zip -X GET https://repo1.maven.org/maven2/org/sonarsource/scanner/cli/sonar-scanner-cli/$SONAR_SCANNER_VERSION/sonar-scanner-cli-$SONAR_SCANNER_VERSION.zip
Ray Milkey20d22522017-11-08 10:55:52 -080014unzip /tmp/sonar-scanner-cli.zip
Ray Milkeyfaa66c92017-11-08 12:58:43 -080015
16# Configure ONOS specific properties
Andrew Grimberg6ecb1b12017-11-16 14:42:39 -080017echo "sonar.host.url=https://sonar.onosproject.org" >>sonar-scanner-$SONAR_SCANNER_VERSION/conf/sonar-scanner.properties
Ray Milkey20d22522017-11-08 10:55:52 -080018
Ray Milkeyfaa66c92017-11-08 12:58:43 -080019# Generate coverage data
20tools/build/onos-prepare-sonar
21
22# Upload coverage to Sonar
Ray Milkey7d9c0362019-01-25 13:06:15 -080023cd bazel-genfiles/sonar-project && $ONOS_ROOT/sonar-scanner-$SONAR_SCANNER_VERSION/bin/sonar-scanner