mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2026-02-17 19:31:10 +00:00
nn
This commit is contained in:
parent
0767c53a83
commit
db7490c07c
1 changed files with 0 additions and 76 deletions
76
Jenkinsfile
vendored
76
Jenkinsfile
vendored
|
|
@ -1,76 +0,0 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
tools {
|
||||
jdk 'jdk17'
|
||||
maven 'maven'
|
||||
}
|
||||
|
||||
environment {
|
||||
SONAR_TOKEN = credentials('edf40d2f41d32dc9a7e0a42cb45aa683e645760c')
|
||||
SONAR_HOST = 'http://localhost:9000' // SonarQube local
|
||||
IMAGE = 'spring-petclinic' // Nom local de l'image Docker
|
||||
TAG = 'latest'
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
git branch: 'main', url: 'https://github.com/zinebmouman/resevation_devices.git'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build & Unit Tests') {
|
||||
steps {
|
||||
dir('backend') {
|
||||
bat 'mvn -B -U clean verify'
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit allowEmptyResults: true, testResults: 'backend/target/surefire-reports/*.xml'
|
||||
archiveArtifacts artifacts: 'backend/target/*.jar', fingerprint: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('SonarQube Analysis') {
|
||||
steps {
|
||||
dir('backend') {
|
||||
bat """
|
||||
mvn sonar:sonar ^
|
||||
-Dsonar.projectKey=resevation_devices ^
|
||||
-Dsonar.host.url=%SONAR_HOST% ^
|
||||
-Dsonar.login=%SONAR_TOKEN%
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Docker locally') {
|
||||
steps {
|
||||
dir('backend') {
|
||||
bat """
|
||||
docker build -t %IMAGE%:%TAG% .
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run Docker locally') {
|
||||
steps {
|
||||
bat """
|
||||
docker stop %IMAGE% || exit 0
|
||||
docker rm %IMAGE% || exit 0
|
||||
docker run -d -p 8080:8080 --name %IMAGE% %IMAGE%:%TAG%
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success { echo "Pipeline OK → Docker local lancé : %IMAGE%:%TAG%" }
|
||||
failure { echo "Pipeline KO" }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue