| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- node{
- stage('checkout'){
- deleteDir()
- checkout scm
- }
- stage('Stop Container'){
- //sh 'docker ps | grep "workflow_" -v | awk -F " " \'{if(NR>1)print $1}\' | xargs docker killdo | xargs docker rm || true'
- //sh 'docker system prune -f'
- sh 'docker ps | grep "workflow_" -v | awk -F " " \'{ if(NR>1) print $1}\' |xargs docker kill |xargs docker rm || true'
- sh 'docker system prune -f'
- }
- stage('Build Container')
- {
- imageApache=docker.build('server-apache-dev', '--no-cache -f build/docker/apache/Dockerfile .')
- imageSql=docker.build('server-mysql-dev', '--no-cache -f build/docker/mysql/Dockerfile .')
- containerMysql=imageSql.run('--name server-mysql-dev')
- containerApache=imageApache.run('-p 8080:80 --link server-mysql-dev:mysql')
- }
- stage('Waiting Container'){
- waitUntil{
- try{
- sh "docker exec ${containerApache.id} php -v"
- return true
- } catch(Exception $e){
- return false
- }
- }
- }
- stage('stage 1bis'){
- sh 'docker -v'
- sh 'docker ps'
- }
-
- stage('stage 2bis'){
- sh 'ls -ls'
- }
- stage('SonarQube analysis') {
- def scannerHome = tool 'sonar_scanner';
-
- withSonarQubeEnv('FatboarSonar')
- {
- // If you have configured more than one global server connection, you can specify its name
- //sh "${scannerHome}/bin/sonar-scanner -Dsonar.login=admin -Dsonar.password=admin" }
- sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=Fatboar_project -Dsonar.sources=. -Dsonar.host.url=https://sonarqube.foodgame.fr Dsonar.login=f4a88fa94b549a727590e4bfec05cdf96af54825"
- }
- }
|