From 1f1496b3c101b343503eff54a0dc61da2a97535b Mon Sep 17 00:00:00 2001 From: thespad Date: Tue, 3 Dec 2024 16:13:47 +0000 Subject: [PATCH] Fail build if any of the buldcache pushes fail --- roles/generate-jenkins/templates/Jenkinsfile.j2 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/generate-jenkins/templates/Jenkinsfile.j2 b/roles/generate-jenkins/templates/Jenkinsfile.j2 index e4106b61..0ed01af5 100644 --- a/roles/generate-jenkins/templates/Jenkinsfile.j2 +++ b/roles/generate-jenkins/templates/Jenkinsfile.j2 @@ -820,7 +820,9 @@ pipeline { for i in "${CACHE[@]}"; do docker push ${i}:amd64-${COMMIT_SHA}-${BUILD_NUMBER} & done - wait + for p in $(jobs -p); do + wait "$p" || { echo "job $p failed" >&2; exit 1; } + done fi ''' } @@ -888,7 +890,9 @@ pipeline { for i in "${CACHE[@]}"; do docker push ${i}:amd64-${COMMIT_SHA}-${BUILD_NUMBER} & done - wait + for p in $(jobs -p); do + wait "$p" || { echo "job $p failed" >&2; exit 1; } + done fi ''' } @@ -951,7 +955,9 @@ pipeline { for i in "${CACHE[@]}"; do docker push ${i}:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} & done - wait + for p in $(jobs -p); do + wait "$p" || { echo "job $p failed" >&2; exit 1; } + done fi ''' }