fix: use manual SonarQube scanner installation
This commit is contained in:
parent
1abd90e256
commit
43405dfce3
1 changed files with 15 additions and 12 deletions
|
|
@ -44,10 +44,13 @@ jobs:
|
||||||
git fetch --depth 1 origin ${{ github.ref }}
|
git fetch --depth 1 origin ${{ github.ref }}
|
||||||
git checkout FETCH_HEAD
|
git checkout FETCH_HEAD
|
||||||
|
|
||||||
- name: Install Node.js and Sonar Scanner
|
- name: Install Java and Sonar Scanner
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache nodejs npm curl openjdk17-jre
|
apk add --no-cache nodejs npm curl openjdk17-jre
|
||||||
npm install -g sonarqube-scanner
|
curl -sSLo /tmp/sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.2.1.4610.zip
|
||||||
|
unzip -q /tmp/sonar-scanner-cli.zip -d /opt
|
||||||
|
rm /tmp/sonar-scanner-cli.zip
|
||||||
|
ln -sf /opt/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner /usr/local/bin/sonar-scanner
|
||||||
|
|
||||||
- name: SonarQube Scan
|
- name: SonarQube Scan
|
||||||
env:
|
env:
|
||||||
|
|
@ -72,7 +75,15 @@ jobs:
|
||||||
echo "Sample files:"
|
echo "Sample files:"
|
||||||
find . -maxdepth 2 -type f | head -n 20
|
find . -maxdepth 2 -type f | head -n 20
|
||||||
echo "Running local sonar-scanner..."
|
echo "Running local sonar-scanner..."
|
||||||
set -- \
|
sonar-scanner \
|
||||||
|
-Dsonar.host.url="$HOST_URL" \
|
||||||
|
-Dsonar.token="$SONAR_TOKEN" \
|
||||||
|
-Dsonar.projectKey="$PROJECT_KEY" \
|
||||||
|
-Dsonar.sources=. \
|
||||||
|
-Dsonar.scm.disabled=true \
|
||||||
|
-Dsonar.projectBaseDir="$WORKDIR" \
|
||||||
|
-Dsonar.branch.name="$BRANCH_NAME" 2>/dev/null || \
|
||||||
|
sonar-scanner \
|
||||||
-Dsonar.host.url="$HOST_URL" \
|
-Dsonar.host.url="$HOST_URL" \
|
||||||
-Dsonar.token="$SONAR_TOKEN" \
|
-Dsonar.token="$SONAR_TOKEN" \
|
||||||
-Dsonar.projectKey="$PROJECT_KEY" \
|
-Dsonar.projectKey="$PROJECT_KEY" \
|
||||||
|
|
@ -80,14 +91,6 @@ jobs:
|
||||||
-Dsonar.scm.disabled=true \
|
-Dsonar.scm.disabled=true \
|
||||||
-Dsonar.projectBaseDir="$WORKDIR"
|
-Dsonar.projectBaseDir="$WORKDIR"
|
||||||
|
|
||||||
if [ "${SONAR_ENABLE_BRANCH:-}" = "true" ]; then
|
|
||||||
set -- "$@" -Dsonar.branch.name="$BRANCH_NAME"
|
|
||||||
else
|
|
||||||
echo "Branch analysis disabled (requires SonarQube Developer Edition)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sonar-scanner "$@"
|
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
needs: [lint, sonar]
|
needs: [lint, sonar]
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue