♻️ refactor(build): enhance sonar scanner configuration
- set default host url for sonar scanner to ensure consistency - add sonar.sources and sonar.scm.provider for improved analysis
This commit is contained in:
parent
56ca1f63d4
commit
8626fa5a0f
1 changed files with 5 additions and 2 deletions
|
|
@ -34,21 +34,24 @@ jobs:
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
|
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
|
||||||
run: |
|
run: |
|
||||||
|
HOST_URL=${SONAR_HOST_URL:-https://sonata.cyber77.de}
|
||||||
PROJECT_KEY="${SONAR_PROJECT_KEY}"
|
PROJECT_KEY="${SONAR_PROJECT_KEY}"
|
||||||
if [ -z "$PROJECT_KEY" ] && [ -f sonar-project.properties ]; then
|
if [ -z "$PROJECT_KEY" ] && [ -f sonar-project.properties ]; then
|
||||||
PROJECT_KEY=$(grep -E '^sonar.projectKey=' sonar-project.properties | cut -d= -f2 | tr -d '\r')
|
PROJECT_KEY=$(grep -E '^sonar.projectKey=' sonar-project.properties | cut -d= -f2 | tr -d '\r')
|
||||||
fi
|
fi
|
||||||
PROJECT_KEY=${PROJECT_KEY:-free-games-claimer}
|
PROJECT_KEY=${PROJECT_KEY:-free-games-claimer}
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e SONAR_HOST_URL="$SONAR_HOST_URL" \
|
-e SONAR_HOST_URL="$HOST_URL" \
|
||||||
-e SONAR_TOKEN="$SONAR_TOKEN" \
|
-e SONAR_TOKEN="$SONAR_TOKEN" \
|
||||||
-v "$PWD:/usr/src" \
|
-v "$PWD:/usr/src" \
|
||||||
-w /usr/src \
|
-w /usr/src \
|
||||||
sonarsource/sonar-scanner-cli \
|
sonarsource/sonar-scanner-cli \
|
||||||
sonar-scanner \
|
sonar-scanner \
|
||||||
-Dsonar.host.url="$SONAR_HOST_URL" \
|
-Dsonar.host.url="$HOST_URL" \
|
||||||
-Dsonar.token="$SONAR_TOKEN" \
|
-Dsonar.token="$SONAR_TOKEN" \
|
||||||
-Dsonar.projectKey="${PROJECT_KEY:-free-games-claimer}" \
|
-Dsonar.projectKey="${PROJECT_KEY:-free-games-claimer}" \
|
||||||
|
-Dsonar.sources=. \
|
||||||
|
-Dsonar.scm.provider=git \
|
||||||
-Dsonar.projectBaseDir=/usr/src
|
-Dsonar.projectBaseDir=/usr/src
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue