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
+5 -4
View File
@@ -1,5 +1,8 @@
pipeline { pipeline {
agent any agent any
tools {
jdk 'JDK17'
}
stages { stages {
stage('Clone') { stage('Clone') {
steps { steps {
@@ -9,6 +12,7 @@ pipeline {
stage('SonarQube Analysis') { stage('SonarQube Analysis') {
steps { steps {
withSonarQubeEnv('sonarqube') { withSonarQubeEnv('sonarqube') {
withEnv(["PATH+SONAR=${tool 'sonar-scanner'}/bin"]) {
sh ''' sh '''
sonar-scanner \ sonar-scanner \
-Dsonar.projectKey=datalab-lite \ -Dsonar.projectKey=datalab-lite \
@@ -20,6 +24,7 @@ pipeline {
} }
} }
} }
}
stage('Quality Gate') { stage('Quality Gate') {
steps { steps {
waitForQualityGate abortPipeline: false waitForQualityGate abortPipeline: false
@@ -28,7 +33,6 @@ pipeline {
stage('Deploy') { stage('Deploy') {
steps { steps {
sh ''' sh '''
# Mettre à jour le ConfigMap code
kubectl create configmap datalab-lite-code \ kubectl create configmap datalab-lite-code \
--from-file=main.py=main.py \ --from-file=main.py=main.py \
--from-file=k8s.py=k8s.py \ --from-file=k8s.py=k8s.py \
@@ -36,15 +40,12 @@ pipeline {
-n datalab-lite \ -n datalab-lite \
--dry-run=client -o yaml | kubectl apply -f - --dry-run=client -o yaml | kubectl apply -f -
# Mettre à jour le ConfigMap templates
kubectl create configmap datalab-lite-templates \ kubectl create configmap datalab-lite-templates \
--from-file=index.html=templates/index.html \ --from-file=index.html=templates/index.html \
-n datalab-lite \ -n datalab-lite \
--dry-run=client -o yaml | kubectl apply -f - --dry-run=client -o yaml | kubectl apply -f -
# Redémarrer le pod
kubectl rollout restart deployment datalab-lite -n datalab-lite kubectl rollout restart deployment datalab-lite -n datalab-lite
echo "✅ Datalab Lite déployé" echo "✅ Datalab Lite déployé"
''' '''
} }