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 { pipeline {
agent any agent any
tools {
jdk 'JDK17'
}
stages { stages {
stage('Clone') { stage('Clone') {
steps { steps {
@@ -9,14 +12,16 @@ pipeline {
stage('SonarQube Analysis') { stage('SonarQube Analysis') {
steps { steps {
withSonarQubeEnv('sonarqube') { withSonarQubeEnv('sonarqube') {
sh ''' withEnv(["PATH+SONAR=${tool 'sonar-scanner'}/bin"]) {
sonar-scanner \ sh '''
-Dsonar.projectKey=datalab-lite \ sonar-scanner \
-Dsonar.projectName="Datalab Lite" \ -Dsonar.projectKey=datalab-lite \
-Dsonar.sources=. \ -Dsonar.projectName="Datalab Lite" \
-Dsonar.inclusions="**/*.py" \ -Dsonar.sources=. \
-Dsonar.python.version=3.11 -Dsonar.inclusions="**/*.py" \
''' -Dsonar.python.version=3.11
'''
}
} }
} }
} }
@@ -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é"
''' '''
} }