X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fsonar-cli.sh;h=d92334e63fd2c75cfa26cff88bf080a2dcba0ca2;hb=04547fcca5cabd3d9ad24fced4a0cf268d789296;hp=d12e6700440f709c332c248703665e3971fd206d;hpb=59b3a3c53b1604b9aa5d46ed8e7083d46c6f95d1;p=releng%2Fglobal-jjb.git diff --git a/shell/sonar-cli.sh b/shell/sonar-cli.sh index d12e6700..d92334e6 100644 --- a/shell/sonar-cli.sh +++ b/shell/sonar-cli.sh @@ -1,21 +1,28 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## -# Copyright (c) 2018 The Linux Foundation and others. +# Copyright (c) 2022 The Linux Foundation and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## +# Non-Maven Sonar CLI +echo "---> sonar-cli.sh" -# This script downloads nexus-iq-cli-1.44.0-01.jar and uses it to perform an -# XC Evaluation or extended report which provides a scan of python files within -# the repo +SCANNER_BIN="sonar-scanner-${SONAR_SCANNER_VERSION}-linux" +export SONAR_SCANNER_HOME="${WORKSPACE}/.sonar/${SCANNER_BIN}" +export PATH="${SONAR_SCANNER_HOME}/bin:${PATH}" -set +x -wget -nv https://download.sonatype.com/clm/scanner/${NEXUS_IQ_CLI_JAR} -O /tmp/${NEXUS_IQ_CLI_JAR} -echo "-a" > cli-auth.txt -echo "${CLM_USER}:${CLM_PASSWORD}" >> cli-auth.txt -java -jar /tmp/${NEXUS_IQ_CLI_JAR} @cli-auth.txt -xc -i ${CLM_PROJECT_NAME} -s https://nexus-iq.wl.linuxfoundation.org -t build . -rm cli-auth.txt +curl --create-dirs -sSLo "${WORKSPACE}"/.sonar/sonar-scanner.zip \ +https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/\ +sonar-scanner-cli-"${SONAR_SCANNER_VERSION}"-linux.zip +unzip -o "${WORKSPACE}"/.sonar/sonar-scanner.zip -d "${WORKSPACE}"/.sonar/ + +echo "Running sonar-scanner" +sonar-scanner \ + -Dsonar.organization="${SONARCLOUD_PROJECT_ORGANIZATION}" \ + -Dsonar.projectKey="${SONARCLOUD_PROJECT_ORGANIZATION}_${SONARCLOUD_PROJECT_KEY}" \ + -Dsonar.sources=. \ + -Dsonar.host.url=https://sonarcloud.io