mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-16 12:45:48 +00:00
Added a jenkins file
This commit is contained in:
parent
2aa53f929d
commit
c6ccbfdfbc
1 changed files with 45 additions and 0 deletions
45
Jenkinsfile
vendored
Normal file
45
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
cron('H 3 * * 1') // Triggers every Monday at 3 minutes past any hour.
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
// Run the Maven build to generate artifact (e.g., JAR file)
|
||||||
|
sh 'mvn clean install'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Jacoco Code Coverage') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
// Run Jacoco to generate code coverage report
|
||||||
|
sh 'mvn jacoco:prepare-agent test jacoco:report'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish Code Coverage') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
// Archive Jacoco report to Jenkins
|
||||||
|
publishHTML(target: [
|
||||||
|
reportName: 'Jacoco Report',
|
||||||
|
reportDir: 'target/site/jacoco',
|
||||||
|
reportFiles: 'index.html',
|
||||||
|
keepAll: true
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue