DESKTOP-SMCIPAV\falko 5 ヶ月 前
コミット
fd1fc6de1e
1 ファイル変更14 行追加20 行削除
  1. 14 20
      Jenkinsfile

+ 14 - 20
Jenkinsfile

@@ -39,10 +39,10 @@ pipeline {
 
 
         stage('Install Dependencies & Test') {
         stage('Install Dependencies & Test') {
             steps {
             steps {
-                sh '''
-                    npm install --legacy-peer-deps
-                    npm run test -- --no-watch --no-progress --browsers=ChromeHeadless
-                '''
+                withEnv(["PATH=${tool 'NodeJS'}/bin:${env.PATH}"]) {
+                    sh 'npm install --legacy-peer-deps'
+                    sh 'npm run test -- --no-watch --no-progress --browsers=ChromeHeadless'
+                }
             }
             }
         }
         }
 
 
@@ -52,11 +52,11 @@ pipeline {
                     def scannerHome = tool name: 'SonarQube Scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
                     def scannerHome = tool name: 'SonarQube Scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
                     withSonarQubeEnv('SonarQube') {
                     withSonarQubeEnv('SonarQube') {
                         sh """
                         sh """
-                        ${scannerHome}/bin/sonar-scanner \
-                        -Dsonar.projectKey=FatboarProject-${env.BRANCH_NAME} \
-                        -Dsonar.sources=. \
-                        -Dsonar.host.url=https://sonarqube.foodgame.fr \
-                        -Dsonar.login=sqa_9ec3588a80a0b8458d9273dbb6eb7f6ae91b446a
+                            ${scannerHome}/bin/sonar-scanner \
+                            -Dsonar.projectKey=FatboarProject-${env.BRANCH_NAME} \
+                            -Dsonar.sources=. \
+                            -Dsonar.host.url=https://sonarqube.foodgame.fr \
+                            -Dsonar.login=sqa_9ec3588a80a0b8458d9273dbb6eb7f6ae91b446a
                         """
                         """
                     }
                     }
                 }
                 }
@@ -79,19 +79,14 @@ pipeline {
                     docker-compose -f ${env.COMPOSE_FILE} build --no-cache
                     docker-compose -f ${env.COMPOSE_FILE} build --no-cache
                     docker-compose -f ${env.COMPOSE_FILE} up -d --force-recreate --remove-orphans
                     docker-compose -f ${env.COMPOSE_FILE} up -d --force-recreate --remove-orphans
                 """
                 """
+                script {
+                    echo "Lancement du backup sur le container ${env.BACKUP_CONTAINER}"
+                    def backupCmd = "docker exec ${env.BACKUP_CONTAINER} /backup.sh || echo '⚠️ Backup ${env.ENV.toUpperCase()} échoué'"
+                    sh backupCmd
+                }
             }
             }
         }
         }
 
 
-        // stage('Backup') {
-        //     steps {
-        //         script {
-        //             echo "Lancement du backup sur le container ${env.BACKUP_CONTAINER}"
-        //             def backupCmd = "docker exec ${env.BACKUP_CONTAINER} /backup.sh || echo '⚠️ Backup ${env.ENV.toUpperCase()} échoué'"
-        //             sh backupCmd
-        //         }
-        //     }
-        // }
-
         stage('Push to Private Registry (Optional)') {
         stage('Push to Private Registry (Optional)') {
             when {
             when {
                 anyOf {
                 anyOf {
@@ -131,7 +126,6 @@ pipeline {
 
 
 
 
 
 
-
 // pipeline {
 // pipeline {
 //     agent any
 //     agent any
 //     environment {
 //     environment {