diff --git a/Jenkinsfile b/JenkinsFile similarity index 65% rename from Jenkinsfile rename to JenkinsFile index 0e6395e79..65dc122d7 100644 --- a/Jenkinsfile +++ b/JenkinsFile @@ -8,16 +8,17 @@ pipeline { environment { SONAR_TOKEN = credentials('edf40d2f41d32dc9a7e0a42cb45aa683e645760c') - SONAR_HOST = 'http://localhost:9000' // SonarQube local - IMAGE = 'spring-petclinic' // Nom local de l'image Docker + SONAR_HOST = 'https://sonarcloud.io' + IMAGE = 'spring-petclinic' TAG = 'latest' + DOCKER_HOST = "tcp://10.52.81.17:2375" // << Nouveau } stages { stage('Checkout') { steps { - git branch: 'main', url: 'https://github.com/zinebmouman/resevation_devices.git' + git branch: 'main', url: 'https://github.com/RhitaKhadijaAssia/spring-petclinic' } } @@ -41,6 +42,7 @@ pipeline { bat """ mvn sonar:sonar ^ -Dsonar.projectKey=resevation_devices ^ + -Dsonar.organization=TON_ORGANISATION ^ -Dsonar.host.url=%SONAR_HOST% ^ -Dsonar.login=%SONAR_TOKEN% """ @@ -48,29 +50,29 @@ pipeline { } } - stage('Build Docker locally') { + stage('Build Docker on remote machine') { steps { dir('backend') { bat """ - docker build -t %IMAGE%:%TAG% . + docker -H %DOCKER_HOST% build -t %IMAGE%:%TAG% . """ } } } - stage('Run Docker locally') { + stage('Run Docker on remote machine') { steps { bat """ - docker stop %IMAGE% || exit 0 - docker rm %IMAGE% || exit 0 - docker run -d -p 8080:8080 --name %IMAGE% %IMAGE%:%TAG% + docker -H %DOCKER_HOST% stop %IMAGE% || exit 0 + docker -H %DOCKER_HOST% rm %IMAGE% || exit 0 + docker -H %DOCKER_HOST% run -d -p 8080:8080 --name %IMAGE% %IMAGE%:%TAG% """ } } } post { - success { echo "Pipeline OK → Docker local lancé : %IMAGE%:%TAG%" } + success { echo "Pipeline OK → Docker lancé sur la machine distante" } failure { echo "Pipeline KO" } } }