Fix: Update CI workflow to use Alpine-based images, install Node.js and Trivy with improved methods, and enhance dependency scanning steps #1
@ -278,18 +278,32 @@ jobs:
|
|||||||
sonar-analysis:
|
sonar-analysis:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: sonarsource/sonar-scanner-cli:latest
|
image: ubuntu:22.04
|
||||||
env:
|
env:
|
||||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Node.js for checkout action
|
- name: Install Node.js for checkout action
|
||||||
run: |
|
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
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Verify SonarQube connection
|
||||||
run: |
|
run: |
|
||||||
echo "Checking SonarQube connectivity..."
|
echo "Checking SonarQube connectivity..."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user