mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 15:55:49 +00:00
add jenkinsfile
This commit is contained in:
parent
b4a0274da4
commit
bbe79bef70
1 changed files with 34 additions and 0 deletions
34
Jenkinsfile
vendored
Normal file
34
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
stages {
|
||||||
|
stage('Checkstyle') {
|
||||||
|
steps {
|
||||||
|
sh 'mvn checkstyle:checkstyle'
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
archiveArtifacts artifacts: '**/target/checkstyle-result.xml', allowEmptyArchive: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Test') {
|
||||||
|
steps {
|
||||||
|
sh 'mvn test'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build Without Tests') {
|
||||||
|
steps {
|
||||||
|
sh 'mvn clean package -DskipTests'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Create Docker Image and Push') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def commitId = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
|
||||||
|
sh "docker build -t your-docker-hub-username/spring-petclinic:${commitId} ."
|
||||||
|
sh "docker push your-docker-hub-username/spring-petclinic:${commitId}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue