From f8c02b3cfcaa7a7e842e6cf615b7c2d3d4e59f85 Mon Sep 17 00:00:00 2001 From: Andil Date: Mon, 24 Aug 2026 19:38:44 +0000 Subject: [PATCH] ci: integrate SonarQube analysis and quality gate --- Jenkinsfile | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 96c842d..e71a8a6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -272,6 +272,50 @@ pipeline { } } + stage('SonarQube Analysis') { + when { + branch 'develop' + } + + steps { + script { + def scannerHome = tool 'sonar-scanner' + + withSonarQubeEnv('sonarqube') { + withCredentials([ + string( + credentialsId: 'sonarqube-token', + variable: 'SONAR_TOKEN' + ) + ]) { + sh """ + ${scannerHome}/bin/sonar-scanner \ + -Dsonar.projectKey=the-tip-top \ + -Dsonar.projectName=THE-TIP-TOP \ + -Dsonar.sources=backend/src,frontend/src \ + -Dsonar.tests=backend/tests,frontend/src/test \ + -Dsonar.javascript.lcov.reportPaths=backend/coverage/lcov.info,frontend/coverage/lcov.info \ + -Dsonar.exclusions=**/node_modules/**,**/coverage/**,**/dist/** \ + -Dsonar.sourceEncoding=UTF-8 \ + -Dsonar.token="${SONAR_TOKEN}" + """ + } + } + } + } +} + +stage('SonarQube Quality Gate') { + when { + branch 'develop' + } + + steps { + timeout(time: 5, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } + } +} stage('Construction des images Docker') { when { expression {