@@ -26,13 +26,30 @@ jobs:
2626 run : echo "git_rev=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
2727
2828 - name : Build and push
29- uses : docker/build-push- action@v6
29+ uses : Wandalen/wretry. action@v3
3030 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
3653
3754 build-arm64 :
3855 runs-on : ubuntu-24.04-arm
@@ -54,13 +71,30 @@ jobs:
5471 run : echo "git_rev=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
5572
5673 - name : Build and push
57- uses : docker/build-push- action@v6
74+ uses : Wandalen/wretry. action@v3
5875 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
6498
6599 merge :
66100 runs-on : ubuntu-latest
0 commit comments