spring-petclinic/Jenkinsfile

52 lines
1.1 KiB
Text
Raw Normal View History

2025-02-26 10:36:50 +00:00
pipeline {
2025-02-27 08:36:21 +00:00
agent {
docker { image 'maven:3.8.5-openjdk-17' }
2025-02-26 10:45:58 +00:00
}
2025-02-27 08:36:21 +00:00
2025-02-26 10:36:50 +00:00
stages {
2025-02-27 12:58:28 +00:00
stage('Checkstyle') {
2025-02-26 10:36:50 +00:00
steps {
2025-02-26 10:45:58 +00:00
checkout scm
sh 'mvn checkstyle:checkstyle'
2025-02-26 10:36:50 +00:00
}
2025-02-27 12:58:28 +00:00
post {
always {
archiveArtifacts artifacts: 'target/checkstyle-result.xml', allowEmptyArchive: true
}
}
}
2025-02-28 09:46:44 +00:00
stage('Test') {
steps {
2025-02-28 09:49:55 +00:00
sh 'mvn test -Dcheckstyle.skip=true'
2025-02-28 09:46:44 +00:00
}
}
2025-02-27 12:58:28 +00:00
stage('Build') {
steps {
2025-02-28 09:40:53 +00:00
sh 'mvn clean package -DskipTests -Dcheckstyle.skip=true'
2025-02-27 12:58:28 +00:00
}
post {
always {
archiveArtifacts artifacts: 'target/*.jar', allowEmptyArchive: true
}
}
2025-02-26 10:36:50 +00:00
}
2025-02-28 10:19:14 +00:00
stage('Build Image') {
agent {
2025-02-28 10:27:24 +00:00
docker {
image 'docker:20.10.16'
args '--privileged -v /var/run/docker.sock:/var/run/docker.sock'
}
2025-02-28 10:19:14 +00:00
}
steps {
2025-02-28 11:06:16 +00:00
checkout scm
2025-02-28 11:13:45 +00:00
def docker_image=docker.build("mr:8084/spring-petclinic:$GIT_COMMIT")
2025-02-28 10:19:14 +00:00
sh 'docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS" mr:8084'
2025-02-28 12:09:48 +00:00
docker.withRegistry('mr:8084') {
docker_image.push()
}
2025-02-28 10:19:14 +00:00
}
}
2025-02-26 10:36:50 +00:00
}
}