From 1cb56cfdd914a6787e0249572de865168f009629 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Sun, 6 Oct 2024 21:34:39 -0500 Subject: [PATCH] chore(ci): retry on ghcr push failures GHCR push operations are subject to semi-frequent random failures. This will use the retry action to mitigate that issue. --- .github/workflows/reusable-build.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index b19b37bf9a1..c92c073ff1c 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -430,14 +430,18 @@ jobs: - name: Push to GHCR id: push if: github.event_name != 'pull_request' - run: | - set -euox pipefail + uses: Wandalen/wretry.action@6feedb7dedadeb826de0f45ff482b53b379a7844 # v3.5.0 + with: + attempt_limit: 3 + attempt_delay: 15000 + command: | + set -euox pipefail - for tag in ${{ steps.build_image.outputs.tags }}; do - sudo podman push ${{ env.IMAGE_NAME }}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${tag} - done - digest=$(skopeo inspect docker://${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} --format '{{.Digest}}') - echo "digest=${digest}" >> $GITHUB_OUTPUT + for tag in ${{ steps.build_image.outputs.tags }}; do + sudo podman push ${{ env.IMAGE_NAME }}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${tag} + done + digest=$(skopeo inspect docker://${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} --format '{{.Digest}}') + echo "digest=${digest}" >> $GITHUB_OUTPUT # Sign container - uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0 @@ -448,14 +452,14 @@ jobs: run: | cosign sign -y --key env://COSIGN_PRIVATE_KEY ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}@${TAGS} env: - TAGS: ${{ steps.push.outputs.digest }} + TAGS: ${{ steps.push.outputs.outputs && fromJSON(steps.push.outputs.outputs).digest }} COSIGN_EXPERIMENTAL: false COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }} - name: Generate file containing outputs if: github.event_name != 'pull_request' env: - DIGEST: ${{ steps.push.outputs.digest }} + DIGEST: ${{ steps.push.outputs.outputs && fromJSON(steps.push.outputs.outputs).digest }} IMAGE_REGISTRY: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }} IMAGE_NAME: ${{ env.IMAGE_NAME }} IMAGE_FLAVOR: ${{ env.image_flavor }}