spring-petclinic/Jenkinsfile

62 lines
1.3 KiB
Text
Raw Normal View History

2025-03-25 19:11:30 +00:00
pipeline {
agent any
environment {
2025-03-25 19:48:00 +00:00
JFROG_CLI_BUILD_NAME = "spring-petclinic"
JFROG_CLI_BUILD_NUMBER = "${BUILD_ID}"
2025-03-25 19:11:30 +00:00
}
stages {
2025-03-25 19:48:00 +00:00
stage('Setup JFrog CLI') {
steps {
jfrog rt config --server-id-resolve jfrog-local --server-id-deploy jfrog-local
}
}
stage('Checkout') {
2025-03-25 19:11:30 +00:00
steps {
2025-03-25 19:48:00 +00:00
git branch: 'main', url: 'https://github.com/JesseHouldsworth/spring-petclinic.git'
2025-03-25 19:11:30 +00:00
}
}
stage('Build with Maven') {
steps {
2025-03-25 19:48:00 +00:00
sh '''
jf mvnc --global \
--repo-resolve-releases=libs-release-local \
--repo-resolve-snapshots=libs-snapshot-local
jf mvn clean install -DskipTests=true -Denforcer.skip=true
'''
}
}
stage('Build Docker Image') {
steps {
sh """
docker build -t localhost:8081/petclinic-docker-dev-local/spring-petclinic:${BUILD_ID} .
"""
2025-03-25 19:11:30 +00:00
}
}
2025-03-25 19:48:00 +00:00
stage('Push Docker Image') {
2025-03-25 19:11:30 +00:00
steps {
2025-03-25 19:48:00 +00:00
sh """
jf docker-push \
localhost:8081/petclinic-docker-dev-local/spring-petclinic:${BUILD_ID} \
petclinic-docker-dev-local
"""
2025-03-25 19:11:30 +00:00
}
}
stage('Publish Build Info') {
steps {
2025-03-25 19:48:00 +00:00
sh '''
jf rt build-collect-env
jf rt build-add-git
jf rt build-publish
'''
2025-03-25 19:11:30 +00:00
}
}
}
}