ci-scripts/sonar.sh
2024-07-21 14:14:09 +02:00

10 lines
413 B
Bash
Executable File

#!/bin/bash
set -e
sonarOpts=(-Dsonar.branch.name="${CI_COMMIT_BRANCH}")
if [[ -n "${CI_COMMIT_PULL_REQUEST}" ]]; then
sonarOpts=(-Dsonar.pullrequest.key="${CI_COMMIT_PULL_REQUEST}" -Dsonar.pullrequest.branch="${CI_COMMIT_SOURCE_BRANCH}" -Dsonar.pullrequest.base="${CI_COMMIT_TARGET_BRANCH}")
fi
sonar-scanner -Dsonar.working.directory=/tmp/.scannerwork -Dsonar.qualitygate.wait=true "${sonarOpts[@]}" || true