Update Jenkinsfile - docker image creation & push

This commit is contained in:
themajerr 2023-07-10 12:29:16 +02:00 committed by GitHub
parent 9abc930921
commit a5895aafca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

12
Jenkinsfile vendored
View file

@ -8,22 +8,26 @@ pipeline {
sh './gradlew check' sh './gradlew check'
} }
} }
stage('PR - Test') { stage('PR - Test') {
when { branch 'PR-*' } when { branch 'PR-*' }
steps { steps {
sh './gradlew test' sh './gradlew test'
} }
} }
stage('PR - Build') { stage('PR - Build') {
when { branch 'PR-*' } when { branch 'PR-*' }
steps { steps {
sh './gradlew build' sh './gradlew clean build'
} }
} }
stage('PR - Push') {
stage('PR - Build + Push') {
when { branch 'PR-*' } when { branch 'PR-*' }
steps { steps {
sh 'echo "<PLACEHOLDER>"' sh 'docker build -t us-west3-docker.pkg.dev/playground-s-11-5cd45b0d/docker-registry/petclinic:$(git tag | tail -1)-$(git rev-parse --short HEAD)'
sh 'docker push us-west3-docker.pkg.dev/playground-s-11-5cd45b0d/docker-registry/petclinic'
} }
} }
@ -33,12 +37,14 @@ pipeline {
sh 'echo "<create tag>"' sh 'echo "<create tag>"'
} }
} }
stage('Main - tag the artifact') { stage('Main - tag the artifact') {
when { branch 'main' } when { branch 'main' }
steps { steps {
sh 'echo "<tag artifact>"' sh 'echo "<tag artifact>"'
} }
} }
stage('Main - push to repo') { stage('Main - push to repo') {
when { branch 'main' } when { branch 'main' }
steps { steps {