Fix: use sonar-scanner tool from Jenkins

This commit is contained in:
2026-06-07 23:32:21 +02:00
parent e0b852dd6b
commit 9bee74e339
Vendored
+13 -12
View File
@@ -1,5 +1,8 @@
pipeline {
agent any
tools {
jdk 'JDK17'
}
stages {
stage('Clone') {
steps {
@@ -9,14 +12,16 @@ pipeline {
stage('SonarQube Analysis') {
steps {
withSonarQubeEnv('sonarqube') {
sh '''
sonar-scanner \
-Dsonar.projectKey=datalab-lite \
-Dsonar.projectName="Datalab Lite" \
-Dsonar.sources=. \
-Dsonar.inclusions="**/*.py" \
-Dsonar.python.version=3.11
'''
withEnv(["PATH+SONAR=${tool 'sonar-scanner'}/bin"]) {
sh '''
sonar-scanner \
-Dsonar.projectKey=datalab-lite \
-Dsonar.projectName="Datalab Lite" \
-Dsonar.sources=. \
-Dsonar.inclusions="**/*.py" \
-Dsonar.python.version=3.11
'''
}
}
}
}
@@ -28,7 +33,6 @@ pipeline {
stage('Deploy') {
steps {
sh '''
# Mettre à jour le ConfigMap code
kubectl create configmap datalab-lite-code \
--from-file=main.py=main.py \
--from-file=k8s.py=k8s.py \
@@ -36,15 +40,12 @@ pipeline {
-n datalab-lite \
--dry-run=client -o yaml | kubectl apply -f -
# Mettre à jour le ConfigMap templates
kubectl create configmap datalab-lite-templates \
--from-file=index.html=templates/index.html \
-n datalab-lite \
--dry-run=client -o yaml | kubectl apply -f -
# Redémarrer le pod
kubectl rollout restart deployment datalab-lite -n datalab-lite
echo "✅ Datalab Lite déployé"
'''
}