DESKTOP-SMCIPAV\falko 5 kuukautta sitten
vanhempi
commit
e14ce63b6f
1 muutettua tiedostoa jossa 35 lisäystä ja 33 poistoa
  1. 35 33
      Jenkinsfile

+ 35 - 33
Jenkinsfile

@@ -44,24 +44,41 @@ pipeline {
         //         }
         //     }
         // }
-//  stage('Stop Containers') {
-//             steps {
-//                 sh '''
-//                  docker ps | grep "workflow_" -v | awk -F " " '{ if(NR>1) print $1}' | xargs docker kill || true
-//                 docker system prune -f
-//                '''
-//             }
-//        }
+        stage('Stop Containers') {
+            steps {
+                sh '''
+                 docker ps | grep "workflow_" -v | awk -F " " '{ if(NR>1) print $1}' | xargs docker kill || true
+                docker system prune -f
+               '''
+            }
+       }
+
+       stage('SonarQube Analysis') {
+            steps {
+                script {
+                    def scannerHome = tool name: 'SonarQube Scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation';
+                    withSonarQubeEnv('SonarQube') { // Nom du serveur SonarQube configuré dans Jenkins
+                        sh """
+                        ${scannerHome}/bin/sonar-scanner \
+                        -Dsonar.projectKey=FatboarProject-${env.BRANCH_NAME} \
+                        -Dsonar.sources=. \
+                        -Dsonar.host.url=https://sonarqube.foodgame.fr \
+                        -Dsonar.login=sqa_9ec3588a80a0b8458d9273dbb6eb7f6ae91b446a
+                        """
+                    }
+                }
+            }
+        }
          
-       stage('Build & Deploy') {
-  steps {
-    sh '''
-      docker-compose stop
-      docker-compose build --no-cache
-      docker-compose up -d --force-recreate --remove-orphans
-    '''
-  }
-}
+//        stage('Build & Deploy') {
+//   steps {
+//     sh '''
+//       docker-compose stop
+//       docker-compose build --no-cache
+//       docker-compose up -d --force-recreate --remove-orphans
+//     '''
+//   }
+// }
 
         // ... (autres stages inchangés)
     }
@@ -112,22 +129,7 @@ pipeline {
 //             }
 //         }
 
-        stage('SonarQube Analysis') {
-            steps {
-                script {
-                    def scannerHome = tool name: 'SonarQube Scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation';
-                    withSonarQubeEnv('SonarQube') { // Nom du serveur SonarQube configuré dans Jenkins
-                        sh """
-                        ${scannerHome}/bin/sonar-scanner \
-                        -Dsonar.projectKey=FatboarProject-${env.BRANCH_NAME} \
-                        -Dsonar.sources=. \
-                        -Dsonar.host.url=https://sonarqube.foodgame.fr \
-                        -Dsonar.login=sqa_9ec3588a80a0b8458d9273dbb6eb7f6ae91b446a
-                        """
-                    }
-                }
-            }
-        }
+        
 
 //         stage('Stop Containers') {
 //             steps {