Fix: Update CI workflow to use Ubuntu 22.04 container, install Node.js and SonarScanner with improved methods, and enhance SonarQube connectivity verification
Some checks failed
CI / lint-and-test (pull_request) Successful in 57s
CI / ansible-validation (pull_request) Successful in 2m6s
CI / secret-scanning (pull_request) Successful in 53s
CI / dependency-scan (pull_request) Successful in 57s
CI / sast-scan (pull_request) Successful in 1m55s
CI / license-check (pull_request) Successful in 54s
CI / vault-check (pull_request) Successful in 1m58s
CI / playbook-test (pull_request) Successful in 1m58s
CI / container-scan (pull_request) Successful in 1m31s
CI / sonar-analysis (pull_request) Failing after 2m36s
CI / workflow-summary (pull_request) Successful in 50s

This commit is contained in:
ilia 2025-12-14 20:51:36 -05:00
parent e54ecfefc1
commit a45ee496e4

View File

@ -278,18 +278,32 @@ jobs:
sonar-analysis:
runs-on: ubuntu-latest
container:
image: sonarsource/sonar-scanner-cli:latest
image: ubuntu:22.04
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- name: Install Node.js for checkout action
run: |
apk add --no-cache nodejs npm curl
apt-get update && apt-get install -y curl
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- name: Check out code
uses: actions/checkout@v4
- name: Install Java and SonarScanner
run: |
apt-get update && apt-get install -y wget curl unzip openjdk-17-jre
# Download and install SonarScanner
SONAR_SCANNER_VERSION=$(curl -s https://api.github.com/repos/SonarSource/sonar-scanner-cli/releases/latest | grep tag_name | cut -d '"' -f 4 | sed 's/v//')
wget -q "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip" -O /tmp/sonar-scanner.zip
unzip -q /tmp/sonar-scanner.zip -d /opt
mv /opt/sonar-scanner-${SONAR_SCANNER_VERSION}-linux /opt/sonar-scanner
ln -s /opt/sonar-scanner/bin/sonar-scanner /usr/local/bin/sonar-scanner
chmod +x /usr/local/bin/sonar-scanner
sonar-scanner --version
- name: Verify SonarQube connection
run: |
echo "Checking SonarQube connectivity..."