Jenkinsfile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. node{
  2. env.NODEJS_HOME = "${tool 'NodeJS'}"
  3. // on linux / mac
  4. env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
  5. // on windows
  6. //env.PATH="${env.NODEJS_HOME};${env.PATH}"
  7. sh 'npm --version'
  8. stage('checkout')
  9. {
  10. deleteDir()
  11. checkout scm
  12. }
  13. stage('Stop Containers')
  14. {
  15. sh 'docker ps | grep "workflow_" -v | awk -F " " \'{ if(NR>1) print $1}\' |xargs docker kill |xargs docker rm || true'
  16. // sh 'docker system prune -f'
  17. }
  18. // stage("Push preprod images to nexus")
  19. // {
  20. // docker.withRegistry('http://localhost:8083','885ef60c-9352-489a-bd1c-e4b695747c21')
  21. // {
  22. // imageApache.push('latest')
  23. // imageExpress.push('latest')
  24. // }*/
  25. // }
  26. // stage('SonarQube analysis')
  27. // {
  28. // def scannerHome = tool name: 'SonarQube Scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation';
  29. // withSonarQubeEnv('SonarQube')
  30. // {
  31. // // If you have configured more than one global server connection, you can specify its name
  32. // sh "${scannerHome}/bin/sonar-scanner \
  33. // -Dsonar.projectKey=FatboarProject \
  34. // -Dsonar.sources=. \
  35. // -Dsonar.host.url=https://sonarqube.foodgame.fr \
  36. // -Dsonar.login=sqp_09ee9072c917af8212864baf0f75c950afc14c64"
  37. // }
  38. // }
  39. stage('Build Docker MEAN Stack(Test Deployment)')
  40. {
  41. sh 'docker-compose -v'
  42. sh 'docker-compose build'
  43. sh 'docker-compose up -d'
  44. }
  45. stage('Fin du Pipeline')
  46. {
  47. sh 'echo "Félicitation tout c\'est bien déroulé!"'
  48. }
  49. }