From 2e57a8169317f866ad74312015d0e398a36a0669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Iwanicki?= Date: Wed, 20 Nov 2024 15:26:59 +0100 Subject: [PATCH] workflow: Fix build failure reported as success MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MichaƂ Iwanicki --- .github/workflows/build.yml | 14 +++++++------- .github/workflows/ci.yml | 1 - .github/workflows/develop.yml | 1 - .github/workflows/weekly.yml | 1 - 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e852d5a7..82940306 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,8 @@ jobs: build: runs-on: labels: dts-builder + env: + FAILED_ATTEMPTS: 0 steps: - name: Checkout meta-dts repo uses: actions/checkout@v4 @@ -31,17 +33,15 @@ jobs: break else echo "Build command failed on attempt $attempt" + echo "FAILED_ATTEMPTS=$attempt" >> $GITHUB_ENV if [ $attempt -lt 5 ]; then sleep 5 + else + exit 1 fi fi done - continue-on-error: true - name: Report build command + if: always() run: | - if [ ${{ steps.build_image.outcome }} == 'failure' ]; then - echo "All build attempts failed." - exit 1 - else - echo "At least one build attempt succeeded." - fi + echo "$FAILED_ATTEMPTS build attempts failed" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bc0d990..c50245e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,6 @@ jobs: cacheless: false deploy-images: name: Deploy DTS artifacts on boot.dasharo.com and GitHub Release - if: ${{ always() && contains(join(needs.*.result, ','), 'success') }} needs: build runs-on: labels: dts-builder diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 1b795679..ba849612 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -12,7 +12,6 @@ jobs: cacheless: false deploy-images: name: Deploy DTS artifacts on boot.dasharo.com - if: ${{ always() && contains(join(needs.*.result, ','), 'success') }} needs: build runs-on: labels: dts-builder diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index 88e12d81..59ddee1a 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -12,7 +12,6 @@ jobs: cacheless: true deploy-cache: name: Deploy cache on cache.dasharo.com - if: always() needs: build runs-on: labels: dts-builder