mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-12-27 19:07:28 +00:00
Update Jenkinsfile
Signed-off-by: Riz Urian <98958099+rizjosel@users.noreply.github.com>
This commit is contained in:
parent
d0933bf5d7
commit
99158070f1
1 changed files with 18 additions and 1 deletions
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
|
|
@ -19,8 +19,9 @@ pipeline {
|
|||
|
||||
stage('Build Application (Gradle)') {
|
||||
steps {
|
||||
sh './gradlew clean build -x test'
|
||||
sh './gradlew clean build'
|
||||
archiveArtifacts artifacts: 'build/libs/*.jar', fingerprint: true
|
||||
junit 'build/test-results/test/*.xml'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -29,6 +30,22 @@ pipeline {
|
|||
sh "docker build -t ${IMAGE_NAME} ."
|
||||
}
|
||||
}
|
||||
|
||||
stage('Test Docker Image') {
|
||||
steps {
|
||||
// Run container for testing
|
||||
sh "docker run -d --name ${APP_NAME}-test -p 8080:8080 ${IMAGE_NAME}"
|
||||
|
||||
// Wait for app to start
|
||||
sh "sleep 10"
|
||||
|
||||
// Health check - if curl fails, this step will fail and stop the pipeline
|
||||
sh "curl -f http://localhost:8080/actuator/health"
|
||||
|
||||
// Stop and remove test container
|
||||
sh "docker stop ${APP_NAME}-test && docker rm ${APP_NAME}-test"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Docker Push') {
|
||||
steps {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue