From 8c27d0ea216f9428c450fb9e60e293d39ac02f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Chamoulaud?= Date: Wed, 22 May 2024 15:53:35 +0200 Subject: [PATCH] DRAFT: Debug Sonarqube runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gaƫl Chamoulaud --- sonarqube.sh | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/sonarqube.sh b/sonarqube.sh index fbce893792..2bc8e00809 100755 --- a/sonarqube.sh +++ b/sonarqube.sh @@ -1,18 +1,20 @@ #!/bin/bash -mkdir $PWD/sonarqube/ -mkdir $PWD/sonarqube/download/ -mkdir $PWD/sonarqube/extract/ -mkdir $PWD/sonarqube/certs/ -mkdir $PWD/sonarqube/store/ +set -eux -curl -o $PWD/sonarqube/certs/RH-IT-Root-CA.crt --insecure $ROOT_CA_CERT_URL +mkdir -p "$PWD"/sonarqube/ +mkdir -p "$PWD"/sonarqube/download/ +mkdir -p "$PWD"/sonarqube/extract/ +mkdir -p "$PWD"/sonarqube/certs/ +mkdir -p "$PWD"/sonarqube/store/ -$JAVA_HOME/bin/keytool \ - -keystore /$PWD/sonarqube/store/RH-IT-Root-CA.keystore \ +curl -o "$PWD"/sonarqube/certs/RH-IT-Root-CA.crt --insecure "$ROOT_CA_CERT_URL" + +"$JAVA_HOME"/bin/keytool \ + -keystore /"$PWD"/sonarqube/store/RH-IT-Root-CA.keystore \ -import \ -alias RH-IT-Root-CA \ - -file /$PWD/sonarqube/certs/RH-IT-Root-CA.crt \ + -file /"$PWD"/sonarqube/certs/RH-IT-Root-CA.crt \ -storepass redhat \ -noprompt @@ -25,26 +27,27 @@ if [[ "$OSTYPE" == "darwin"* ]]; then fi export SONAR_SCANNER_CLI_VERSION="4.7.0.2747" -export SONAR_SCANNER_DOWNLOAD_NAME="sonar-scanner-cli-$SONAR_SCANNER_CLI_VERSION-$SONAR_SCANNER_OS" -export SONAR_SCANNER_NAME="sonar-scanner-$SONAR_SCANNER_CLI_VERSION-$SONAR_SCANNER_OS" - -curl -o $PWD/sonarqube/download/$SONAR_SCANNER_DOWNLOAD_NAME.zip --insecure $SONARQUBE_CLI_URL +export SONAR_SCANNER_DOWNLOAD_NAME="sonar-scanner-cli-${SONAR_SCANNER_CLI_VERSION}-${SONAR_SCANNER_OS}" +export SONAR_SCANNER_NAME="sonar-scanner-${SONAR_SCANNER_CLI_VERSION}-${SONAR_SCANNER_OS}" -unzip -d $PWD/sonarqube/extract/ $PWD/sonarqube/download/$SONAR_SCANNER_DOWNLOAD_NAME.zip +curl -o "$PWD"/sonarqube/download/"$SONAR_SCANNER_DOWNLOAD_NAME".zip --insecure "$SONARQUBE_CLI_URL" +unzip -d "$PWD"/sonarqube/extract/ "$PWD"/sonarqube/download/"$SONAR_SCANNER_DOWNLOAD_NAME".zip export PATH="$PWD/sonarqube/extract/$SONAR_SCANNER_NAME/bin:$PATH" COMMIT_SHORT=$(git rev-parse --short=7 HEAD) +ls -l "$PWD"/sonarqube/extract/"$SONAR_SCANNER_NAME"/bin/ + sonar-scanner \ -Dsonar.projectKey=console.redhat.com:insights-host-inventory \ - -Dsonar.sources=$PWD \ - -Dsonar.host.url=$SONARQUBE_REPORT_URL \ - -Dsonar.projectVersion=$COMMIT_SHORT \ - -Dsonar.login=$SONARQUBE_TOKEN + -Dsonar.sources="$PWD" \ + -Dsonar.host.url="$SONARQUBE_REPORT_URL" \ + -Dsonar.projectVersion="$COMMIT_SHORT" \ + -Dsonar.login="$SONARQUBE_TOKEN" -mkdir -p $WORKSPACE/artifacts -cat << EOF > ${WORKSPACE}/artifacts/junit-dummy.xml +mkdir -p "$WORKSPACE"/artifacts +cat << EOF > "${WORKSPACE}"/artifacts/junit-dummy.xml