From d17a3c7995c4f2ca427fdcf7837fb37f4b372b21 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Wed, 27 Apr 2022 15:57:39 +0200 Subject: [PATCH] fix if condition on pending stage --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a9d7449..5ae80a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -94,10 +94,10 @@ pipeline { steps { sh ''' echo "Cron build enabled. New deploy of ${TRIGGER_JOB} - ${TRIGGER_VERSION} will be added to the deploy file" - if( !(grep "${TRIGGER_JOB}" ${DEPLOY_FILE})) then - echo "${TRIGGER_JOB},${TRIGGER_VERSION}" >> ${DEPLOY_FILE} + if grep -q "${TRIGGER_JOB}" ${DEPLOY_FILE} then + echo "component ${TRIGGER_JOB} already added. Nothing to add." else - echo "component ${TRIGGER_JOB} already added" + echo "${TRIGGER_JOB},${TRIGGER_VERSION}" >> ${DEPLOY_FILE} ''' } }