Skip to content

Commit

Permalink
Retry failed repo builds (#21)
Browse files Browse the repository at this point in the history
We had failed repo builds quite often recently which causes manual effort.
Let's try to mitigate this using retry logic.

Taken from https://github.com/gardenlinux/repo-debian-snapshot/tree/main/.github/workflows

Fixes gardenlinux/gardenlinux#2288
(hopefully)
  • Loading branch information
fwilhe authored Aug 28, 2024
1 parent 43d82af commit bb543e2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,13 @@ jobs:
build /create_dist /repo today 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
aws s3 cp --recursive 'repo/dists/today' 's3://${{ vars.S3_BUCKET }}/gardenlinux/dists/today'
aws cloudfront create-invalidation --distribution-id '${{ secrets.CLOUDFRONT_DISTRIBUTION }}' --paths '/gardenlinux/dists/today/*'
# Attempt to make CI more resilient using retry logic https://github.com/gardenlinux/gardenlinux/issues/2288
re-run:
needs: [ build ]
if: failure() && fromJSON(github.run_attempt) < 3
runs-on: ubuntu-latest
steps:
- env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: gh workflow run rerun-build.yml -F run_id=${{ github.run_id }}
17 changes: 17 additions & 0 deletions .github/workflows/rerun-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: re-run build
on:
workflow_dispatch:
inputs:
run_id:
required: true
jobs:
rerun:
runs-on: ubuntu-latest
steps:
- name: rerun ${{ inputs.run_id }}
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: |
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
gh run rerun ${{ inputs.run_id }} --failed

0 comments on commit bb543e2

Please sign in to comment.