Update Jenkinsfile

This commit is contained in:
Mihai Georgescu 2023-12-04 09:53:42 +02:00 committed by GitHub
parent 3750a7d571
commit 64e98ac289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

16
Jenkinsfile vendored
View file

@ -46,9 +46,7 @@ pipeline {
stage('Tag the docker image') { stage('Tag the docker image') {
when { when {
// Condition to execute the stage when the branch is main // Condition to execute the stage when the branch is main
expression { changeRequest()
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"
@ -99,8 +97,10 @@ pipeline {
} }
stage('Tag docker image again for the main repo') { stage('Tag docker image again for the main repo') {
when { when {
// Condition to execute the stage when the branch is main // Condition to execute the stage when the branch is 'main'
changeRequest() expression {
return env.BRANCH_NAME == 'main'
}
} }
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"
@ -116,8 +116,10 @@ pipeline {
} }
stage('Push docker image to main repository') { stage('Push docker image to main repository') {
when { when {
// Condition to execute the stage when the branch is main // Condition to execute the stage when the branch is 'main'
changeRequest() expression {
return env.BRANCH_NAME == 'main'
}
} }
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"