From 4411f8c369dfcff1ed3c3731501fdc01ef515398 Mon Sep 17 00:00:00 2001 From: Mihai Georgescu Date: Wed, 29 Nov 2023 14:58:15 +0200 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9283bcb8a..709add3d6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,7 +47,7 @@ pipeline { when { // Condition to execute the stage when the branch is main expression { - return (env.CHANGE_ID == null && env.BRANCH_NAME == 'main') + return (env.CHANGE_ID == null && env.BRANCH_NAME != 'main') } } steps { @@ -78,9 +78,7 @@ pipeline { 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') - } + changeRequest() } steps { echo "now we will push to the docker file" @@ -122,8 +120,8 @@ pipeline { when { // Condition to execute the stage on a pull request event expression { - return env.CHANGE_ID != null - } + return (env.CHANGE_ID == null && env.BRANCH_NAME == 'main') + } } steps { echo "now we will push the image to the docker main repository"