Skip to content

Commit

Permalink
Fix unknown variable on long lived branches
Browse files Browse the repository at this point in the history
  • Loading branch information
vnaskos-sonar committed Nov 29, 2024
1 parent a908f97 commit 70d3c82
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .cirrus/sonarqube-cloud-analysis.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -xeuo pipefail
set -xeo pipefail

SONAR_PARAMS=(
-k:"${CIRRUS_REPO_NAME}"
Expand All @@ -14,15 +14,15 @@ SONAR_PARAMS=(
-d:sonar.scanner.scanAll=false
)

if [ "$CIRRUS_BRANCH" == "master" ] && [ "$CIRRUS_PR" == "false" ]; then
if [ "$CIRRUS_BRANCH" == "master" ] && [ -z "$CIRRUS_PR" ]; then
echo '======= Analyze master branch'
dotnet sonarscanner begin "${SONAR_PARAMS[@]}"

elif [[ "$CIRRUS_BRANCH" == "branch-"* || "$CIRRUS_BRANCH" == "feature/"* ]] && [ "$CIRRUS_PR" == "false" ]; then
elif [[ "$CIRRUS_BRANCH" == "branch-"* || "$CIRRUS_BRANCH" == "feature/"* ]] && [ -z "$CIRRUS_PR" ]; then
echo '======= Analyze long lived branch'
dotnet sonarscanner begin "${SONAR_PARAMS[@]}" -d:sonar.branch.name="${CIRRUS_BRANCH}"

elif [ "$CIRRUS_PR" != "false" ]; then
elif [ -n "$CIRRUS_PR" ]; then
echo '======= Analyze pull request'
dotnet sonarscanner begin "${SONAR_PARAMS[@]}" \
-d:sonar.pullrequest.key="${CIRRUS_PR}" \
Expand Down

0 comments on commit 70d3c82

Please sign in to comment.