spring-petclinic/Jenkinsfile

66 lines
1.4 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 {
2025-03-25 19:51:14 +00:00
sh '''
jfrog rt config --server-id-resolve jfrog-local --server-id-deploy jfrog-local --interactive=false
'''
2025-03-25 19:48:00 +00:00
}
}
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 '''
2025-03-25 19:51:14 +00:00
chmod +x mvnw
2025-03-25 19:48:00 +00:00
jf mvnc --global \
--repo-resolve-releases=libs-release-local \
--repo-resolve-snapshots=libs-snapshot-local
2025-03-25 19:51:14 +00:00
2025-03-25 19:48:00 +00:00
jf mvn clean install -DskipTests=true -Denforcer.skip=true
'''
}
}
stage('Build Docker Image') {
steps {
2025-03-25 19:51:14 +00:00
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:51:14 +00:00
sh '''
2025-03-25 19:48:00 +00:00
jf docker-push \
2025-03-25 19:51:14 +00:00
localhost:8081/petclinic-docker-dev-local/spring-petclinic:$BUILD_ID \
2025-03-25 19:48:00 +00:00
petclinic-docker-dev-local
2025-03-25 19:51:14 +00:00
'''
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
}
}
}
}