mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-16 04:35:49 +00:00
Added Jenkinsfile for CI pipeline
This commit is contained in:
parent
6328d2c9dc
commit
9a516318ca
1 changed files with 55 additions and 0 deletions
55
Jenkinsfile
vendored
Normal file
55
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
triggers {
|
||||
cron('H/3 * * * 4') // Runs every 3 minutes on Thursdays
|
||||
}
|
||||
|
||||
tools {
|
||||
maven 'Maven 3'
|
||||
jdk 'JDK 11'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
git 'https://github.com/girisujan2001/spring-petclinic.git'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'mvn clean package'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Test & Code Coverage') {
|
||||
steps {
|
||||
sh 'mvn test'
|
||||
sh 'mvn jacoco:report'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Archive Artifacts') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: 'target/*.jar', fingerprint: true
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish Jacoco Report') {
|
||||
steps {
|
||||
jacoco execPattern: '**/target/jacoco.exec', classPattern: '**/target/classes', sourcePattern: '**/src/main/java'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo 'Pipeline executed successfully!'
|
||||
}
|
||||
failure {
|
||||
echo 'Pipeline failed!'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue