This commit is contained in:
parent
86cd25435e
commit
12a0b2b1a3
13
.drone.yml
13
.drone.yml
@ -35,16 +35,23 @@ steps:
|
|||||||
- name: code-analysis
|
- name: code-analysis
|
||||||
image: openjdk:11-jre-slim
|
image: openjdk:11-jre-slim
|
||||||
commands:
|
commands:
|
||||||
# Install wget and unzip
|
# Update package lists and install dependencies for Node.js
|
||||||
- apt-get update && apt-get install -y wget unzip
|
- apt-get update && apt-get install -y curl gnupg wget unzip
|
||||||
|
# Install Node.js (e.g., version 18) using Nodesource setup script
|
||||||
|
- curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
|
||||||
|
- apt-get install -y nodejs
|
||||||
|
# Verify Node.js is installed
|
||||||
|
- node -v
|
||||||
|
- npm -v
|
||||||
# Download the SonarScanner CLI zip (adjust the version as needed)
|
# Download the SonarScanner CLI zip (adjust the version as needed)
|
||||||
- wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-7.0.2.4839-linux-aarch64.zip -O sonar-scanner.zip
|
- wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-7.0.2.4839-linux-aarch64.zip -O sonar-scanner.zip
|
||||||
# Unzip it to /opt
|
# Unzip it to /opt
|
||||||
- unzip sonar-scanner.zip -d /opt/
|
- unzip sonar-scanner.zip -d /opt/
|
||||||
|
- rm sonar-scanner.zip
|
||||||
# Add sonar-scanner to the PATH (the folder name may vary with version)
|
# Add sonar-scanner to the PATH (the folder name may vary with version)
|
||||||
- export PATH=/opt/sonar-scanner-7.0.2.4839-linux-aarch64/bin:$PATH
|
- export PATH=/opt/sonar-scanner-7.0.2.4839-linux-aarch64/bin:$PATH
|
||||||
# Run the scanner
|
# Run the scanner
|
||||||
- sonar-scanner -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.sources=. -Dsonar.host.url=$SONAR_INSTANCE_URL -Dsonar.login=$SONAR_LOGIN_KEY
|
- sonar-scanner -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.sources=. -Dsonar.host.url=$SONAR_INSTANCE_URL -Dsonar.token=$SONAR_LOGIN_KEY
|
||||||
environment:
|
environment:
|
||||||
SONAR_PROJECT_KEY:
|
SONAR_PROJECT_KEY:
|
||||||
from_secret: sonar_project_key
|
from_secret: sonar_project_key
|
||||||
|
Loading…
x
Reference in New Issue
Block a user