formation hai 11 meses
pai
achega
f0d8443953
Modificáronse 1 ficheiros con 120 adicións e 1 borrados
  1. 120 1
      Jenkinsfile

+ 120 - 1
Jenkinsfile

@@ -101,6 +101,7 @@ pipeline {
             }
         }
     }
+<<<<<<< HEAD
     post {
         success {
             echo "Pipeline exécuté avec succès pour la branche ${env.BRANCH_NAME}."
@@ -167,4 +168,122 @@ pipeline {
 //     {
 //        sh 'echo "Félicitation tout c\'est bien déroulé!"'  
 //    }
-// }
+=======
+    // stage('Test') 
+    // {
+        
+    //    dir("${env.WORKSPACE}/angular-client")
+    //    {
+    //         // sh 'npm i @angular-devkit/build-angular'
+          		
+	// 		// try
+	// 		// {
+	// 		// 	sh 'npm run test-ci'
+	// 		// } 
+	// 		// catch(err) 
+	// 		// {
+	// 		// 	sh 'echo TEST FAILED'
+	// 		// 	junit 'target/surefire-reports/TESTS-TestSuite.xml/*.xml'
+	// 		// 	throw err
+	// 		// }
+            
+    //         def karma = docker.image('trion/ng-cli-karma')
+    //         karma.pull()
+
+    //         try 
+    //         {
+    //             karma.run(' -u $(id -u) -v ${WORKSPACE}:/app trion/ng-cli-karma ')
+    //             karma.inside 
+    //             {
+    //                 sh 'npm install'
+                
+    //                 try 
+    //                 {
+    //                     sh ('karma start karma.conf.js')
+    //                 }
+    //                 catch(err) 
+    //                 {
+    //                     sh 'echo TEST FAILED'
+    //                     step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/TESTS-TestSuite.xml/*.xml', healthScaleFactor: 1.0])
+    //                     throw err
+    //                 }
+    //                 sh 'echo DO SOMETHING ELSE AFTER TEST'
+    //             }
+    //             sh 'ls -al '
+    //         } 
+    //         catch(err) 
+    //         {
+    //         sh 'echo RUN DOCKER FAILED'
+    //         throw err
+    //         }
+    //    }
+    // }
+
+
+    // def imageApache = stage("Build apache preprod")
+	// {
+	// 	docker.build("server-apache-preprod", "--no-cache --label traefik.enable=true --label traefik.http.routers.server-apache-preprod.rule='Host(`angular-preprod.foodgame.fr`)' --label traefik.http.routers.server-apache-preprod.entrypoints=websecure --label traefik.http.routers.server-apache-preprod.tls.certresolver=myresolver -f build/docker/httpd/Dockerfile .")
+	// }
+	
+	// def imageExpress = stage("Build express preprod")
+	// {
+	// 	docker.build("server-express-preprod", "--no-cache   -f express-server/Dockerfile express-server")
+	// }
+
+    /*stage("Run Container express preprod")
+	{
+		containerSql=imageExpress.run("--name server-express-preprod -v /var/log:/var/www/app/log/root  --link database_preprod:mongo --network=web")
+	}
+    stage("Run Container apache preprod")
+	{
+		containerApache=imageApache.run("--name server-apache-preprod --link server-mysql-preprod:mysql --network=web")
+	}*/
+
+
+	/*stage("Run Container express preprod")
+	{
+		containerSql=imageExpress.run("--name server-express-preprod -v /home/projet/fatboar/${e}/mysql:/var/lib/mysql --network=web")
+	}
+	
+	stage("Run Container apache preprod")
+	{
+		containerApache=imageApache.run("--name server-apache-preprod --link server-mysql-preprod:mysql --network=web")
+	}*/
+
+
+    // stage("Push preprod images to nexus")
+	// {
+	// 	/*docker.withRegistry('http://localhost:8083','885ef60c-9352-489a-bd1c-e4b695747c21')
+	// 	{
+	// 		imageApache.push('latest')
+	// 		imageExpress.push('latest')
+	// 	}*/
+	// }
+    // stage('SonarQube analysis') 
+    // {  
+    //      def scannerHome = tool name: 'SonarQube Scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation';
+    //     withSonarQubeEnv('SonarQube') 
+    //     { 
+    //     // If you have configured more than one global server connection, you can specify its name
+    //     sh "${scannerHome}/bin/sonar-scanner  \
+    //     -Dsonar.projectKey=FatboarProject \
+    //     -Dsonar.sources=. \
+    //     -Dsonar.host.url=https://sonarqube.foodgame.fr \
+    //     -Dsonar.login=sqp_09ee9072c917af8212864baf0f75c950afc14c64"
+    //     }
+    // }
+	
+
+    stage('Build Docker MEAN Stack(PreProduction Deployment)') 
+    {
+        sh 'docker-compose -v'
+        sh 'docker-compose build'
+        sh 'docker-compose up -d'
+    }
+   
+    stage('Fin du Pipeline') 
+    {
+       sh 'echo "Félicitation tout c\'est bien déroulé!"'  
+   }
+}
+>>>>>>> jenkinsfile