objective categorical abstract machine language personal data server

Retry build on network error

futur.blue 9c52ddd9 cef3dac1

verified
+46 -12
+46 -12
.github/workflows/build.yml
··· 26 26 run: echo "git_rev=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT 27 27 28 28 - name: Build and push 29 - uses: docker/build-push-action@v6 29 + uses: Wandalen/wretry.action@v3 30 30 with: 31 - push: true 32 - tags: ghcr.io/futurgh/pegasus:${{ github.sha }}-amd64 33 - build-args: GIT_REV=${{ steps.rev_parse.outputs.git_rev }} 34 - cache-from: type=gha,scope=amd64 35 - cache-to: type=gha,scope=amd64,mode=max 31 + attempt_limit: 3 32 + retry_condition: steps._this.outputs.retryable != 'false' 33 + command: | 34 + set +e 35 + output=$(docker buildx build \ 36 + --push \ 37 + --tag ghcr.io/futurgh/pegasus:${{ github.sha }}-amd64 \ 38 + --build-arg GIT_REV=${{ steps.rev_parse.outputs.git_rev }} \ 39 + --cache-from type=gha,scope=amd64 \ 40 + --cache-to type=gha,scope=amd64,mode=max \ 41 + . 2>&1) 42 + exit_code=$? 43 + echo "$output" 44 + if [ $exit_code -eq 0 ]; then 45 + exit 0 46 + elif echo "$output" | grep -qE "download failed|50[0-9]|Connection (refused|reset|timed out)"; then 47 + echo "retrying network error" 48 + exit 1 49 + else 50 + echo "retryable=false" >> $GITHUB_OUTPUT 51 + exit 1 52 + fi 36 53 37 54 build-arm64: 38 55 runs-on: ubuntu-24.04-arm ··· 54 71 run: echo "git_rev=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT 55 72 56 73 - name: Build and push 57 - uses: docker/build-push-action@v6 74 + uses: Wandalen/wretry.action@v3 58 75 with: 59 - push: true 60 - tags: ghcr.io/futurgh/pegasus:${{ github.sha }}-arm64 61 - build-args: GIT_REV=${{ steps.rev_parse.outputs.git_rev }} 62 - cache-from: type=gha,scope=arm64 63 - cache-to: type=gha,scope=arm64,mode=max 76 + attempt_limit: 3 77 + retry_condition: steps._this.outputs.retryable != 'false' 78 + command: | 79 + set +e 80 + output=$(docker buildx build \ 81 + --push \ 82 + --tag ghcr.io/futurgh/pegasus:${{ github.sha }}-arm64 \ 83 + --build-arg GIT_REV=${{ steps.rev_parse.outputs.git_rev }} \ 84 + --cache-from type=gha,scope=arm64 \ 85 + --cache-to type=gha,scope=arm64,mode=max \ 86 + . 2>&1) 87 + exit_code=$? 88 + echo "$output" 89 + if [ $exit_code -eq 0 ]; then 90 + exit 0 91 + elif echo "$output" | grep -qE "download failed|50[0-9]|Connection (refused|reset|timed out)"; then 92 + echo "retrying network error" 93 + exit 1 94 + else 95 + echo "retryable=false" >> $GITHUB_OUTPUT 96 + exit 1 97 + fi 64 98 65 99 merge: 66 100 runs-on: ubuntu-latest