diff --git a/Jenkinsfile b/Jenkinsfile index 4c202d3..ef3c40c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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é" ''' }