diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2deaa654..f496b5af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -80,11 +80,10 @@ SonarQube: extends: .terraform script: - schutzbot/sonarqube.sh - parallel: - matrix: - - RUNNER: - - aws/centos-stream-8-x86_64 - INTERNAL_NETWORK: "true" + variables: + RUNNER: aws/centos-stream-8-x86_64 + INTERNAL_NETWORK: "true" + GIT_DEPTH: 0 finish: stage: finish diff --git a/schutzbot/sonarqube.sh b/schutzbot/sonarqube.sh index 106f33e2..ca2e7022 100755 --- a/schutzbot/sonarqube.sh +++ b/schutzbot/sonarqube.sh @@ -9,16 +9,8 @@ sudo dnf install -y unzip curl "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_CLI_VERSION-linux.zip" -o sonar-scanner-cli.zip unzip -q sonar-scanner-cli.zip -SONAR_SCANNER_CMD="$(pwd)/sonar-scanner-$SONAR_SCANNER_CLI_VERSION-linux/bin/sonar-scanner" +SONAR_SCANNER_CMD="sonar-scanner-$SONAR_SCANNER_CLI_VERSION-linux/bin/sonar-scanner" -# SonarQube complains about shallow git clone so do a full checkout in tempdir -FOLDER="$(mktemp -d)" -pushd "$FOLDER" -git clone http://github.com/osbuild/osbuild -cd osbuild -PR_NUMBER=${CI_COMMIT_BRANCH/*-/} -git fetch origin pull/"$PR_NUMBER"/head:sonarscan -git checkout sonarscan $SONAR_SCANNER_CMD -Dsonar.projectKey=osbuild:osbuild \ -Dsonar.sources=. \ -Dsonar.host.url=https://sonarqube.corp.redhat.com \ @@ -26,7 +18,6 @@ $SONAR_SCANNER_CMD -Dsonar.projectKey=osbuild:osbuild \ -Dsonar.pullrequest.branch="$CI_COMMIT_BRANCH" \ -Dsonar.pullrequest.key="$CI_COMMIT_SHA" \ -Dsonar.pullrequest.base="main" -popd SONARQUBE_URL="https://sonarqube.corp.redhat.com/dashboard?id=osbuild%3Aosbuild&pullRequest=$CI_COMMIT_SHA" # Report back to GitHub