From 3750a7d5713c8ce13beeeea8ea58270b71fd503f Mon Sep 17 00:00:00 2001 From: Mihai Georgescu Date: Wed, 29 Nov 2023 15:24:21 +0200 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 709add3d6..16bbed451 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,11 +99,9 @@ pipeline { } 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 + // Condition to execute the stage when the branch is main + changeRequest() } - } steps { echo "now we will tag the docker image for the main branch" script { @@ -118,11 +116,9 @@ pipeline { } stage('Push docker image to main repository') { when { - // Condition to execute the stage on a pull request event - expression { - return (env.CHANGE_ID == null && env.BRANCH_NAME == 'main') - } - } + // Condition to execute the stage when the branch is main + changeRequest() + } steps { echo "now we will push the image to the docker main repository" script {