Retry deploy mirror push
- SHA
1872d5d61a90078da84c01eb9c9bf2043d3e0465- Parents
-
ecd35ed - Tree
bd58509
1872d5d
1872d5d61a90078da84c01eb9c9bf2043d3e0465ecd35ed
bd58509| Status | File | + | - |
|---|---|---|---|
| M |
.github/workflows/deploy.yml
|
30 | 4 |
.github/workflows/deploy.ymlmodified@@ -100,13 +100,39 @@ jobs: | ||
| 100 | 100 | # diverges from origin/trunk, the push fails non-fast-forward |
| 101 | 101 | # and a human reconciles. We never want a runner to silently |
| 102 | 102 | # overwrite a human edit on the mirror. |
| 103 | + # | |
| 104 | + # The app may still be coming back through Caddy immediately | |
| 105 | + # after the systemd restart. Wait for the public HTTP surface | |
| 106 | + # and retry the mirror push so a transient 502 does not mark a | |
| 107 | + # successful deploy as failed. Persistent auth, divergence, or | |
| 108 | + # server errors still fail the job. | |
| 103 | 109 | - name: Mirror to shithub.sh |
| 104 | 110 | if: success() |
| 105 | 111 | env: |
| 106 | 112 | SHITHUB_PUSH_USER: ${{ secrets.SHITHUB_PUSH_USER }} |
| 107 | 113 | SHITHUB_PUSH_PAT: ${{ secrets.SHITHUB_PUSH_PAT }} |
| 108 | 114 | run: | |
| 109 | - git -c "credential.helper=!f() { echo username=$SHITHUB_PUSH_USER; echo password=$SHITHUB_PUSH_PAT; }; f" \ | |
| 110 | - push \ | |
| 111 | - https://shithub.sh/tenseleyflow/shithub.git \ | |
| 112 | - HEAD:trunk | |
| 115 | + curl --fail --silent --show-error \ | |
| 116 | + --retry 6 --retry-delay 5 --retry-all-errors \ | |
| 117 | + https://shithub.sh/ \ | |
| 118 | + --output /dev/null | |
| 119 | + | |
| 120 | + mirror_push() { | |
| 121 | + git -c "credential.helper=!f() { echo username=$SHITHUB_PUSH_USER; echo password=$SHITHUB_PUSH_PAT; }; f" \ | |
| 122 | + push \ | |
| 123 | + https://shithub.sh/tenseleyflow/shithub.git \ | |
| 124 | + HEAD:trunk | |
| 125 | + } | |
| 126 | + | |
| 127 | + status=0 | |
| 128 | + for attempt in 1 2 3 4 5; do | |
| 129 | + if mirror_push; then | |
| 130 | + exit 0 | |
| 131 | + fi | |
| 132 | + status=$? | |
| 133 | + if [ "$attempt" -eq 5 ]; then | |
| 134 | + break | |
| 135 | + fi | |
| 136 | + sleep "$((attempt * 10))" | |
| 137 | + done | |
| 138 | + exit "$status" | |