mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 07:45:49 +00:00
Update Jenkinsfile
This commit is contained in:
parent
0a9ac99617
commit
7e4a4c6389
1 changed files with 22 additions and 0 deletions
22
Jenkinsfile
vendored
22
Jenkinsfile
vendored
|
@ -44,6 +44,12 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Tag the docker image') {
|
stage('Tag the docker image') {
|
||||||
|
when {
|
||||||
|
// Condition to execute the stage when the branch is main
|
||||||
|
expression {
|
||||||
|
return (env.CHANGE_ID == null && env.BRANCH_NAME == 'main')
|
||||||
|
}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
echo "now we will tag the docker image"
|
echo "now we will tag the docker image"
|
||||||
script {
|
script {
|
||||||
|
@ -70,6 +76,12 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push to DockerHub') {
|
stage('Push to DockerHub') {
|
||||||
|
when {
|
||||||
|
// Condition to execute the stage when the branch is main
|
||||||
|
expression {
|
||||||
|
return (env.CHANGE_ID == null && env.BRANCH_NAME == 'main')
|
||||||
|
}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
echo "now we will push to the docker file"
|
echo "now we will push to the docker file"
|
||||||
script {
|
script {
|
||||||
|
@ -88,6 +100,11 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Tag docker image again for the main repo') {
|
stage('Tag docker image again for the main repo') {
|
||||||
|
when {
|
||||||
|
// Condition to execute the stage on a pull request event
|
||||||
|
expression {
|
||||||
|
return env.CHANGE_ID != null
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
echo "now we will tag the docker image for the main branch"
|
echo "now we will tag the docker image for the main branch"
|
||||||
script {
|
script {
|
||||||
|
@ -101,6 +118,11 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push docker image to main repository') {
|
stage('Push docker image to main repository') {
|
||||||
|
when {
|
||||||
|
// Condition to execute the stage on a pull request event
|
||||||
|
expression {
|
||||||
|
return env.CHANGE_ID != null
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
echo "now we will push the image to the docker main repository"
|
echo "now we will push the image to the docker main repository"
|
||||||
script {
|
script {
|
||||||
|
|
Loading…
Reference in a new issue