Skip to content

Commit c6ccd87

Browse files
authored
ci(docker): retry and time-bound every supersetbot call in the build command check (#46594)
1 parent 080529a commit c6ccd87

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

‎.github/workflows/docker.yml‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,28 @@ jobs:
136136
# Any other failure is returned as-is, and the assertions below run
137137
# on the command a successful invocation printed, so they are never
138138
# retried.
139+
# Each call is bounded: on a drained API quota supersetbot sleeps
140+
# until the reset (its warning buffered in "$err") instead of
141+
# failing, which would otherwise hang silently to the job timeout.
139142
supersetbot_dry_run() {
140-
local attempt out err
143+
local attempt out err rc call_timeout=60
141144
out="$(mktemp)"
142145
err="$(mktemp)"
143146
for attempt in 1 2 3; do
144-
if supersetbot docker "$@" --dry-run >"$out" 2>"$err"; then
147+
rc=0
148+
timeout "$call_timeout" supersetbot docker "$@" --dry-run >"$out" 2>"$err" || rc=$?
149+
if [ "$rc" -eq 0 ]; then
145150
cat "$err" >&2
146151
cat "$out"
147152
rm -f "$out" "$err"
148153
return 0
149154
fi
150155
cat "$err" >&2
156+
if [ "$rc" -eq 124 ]; then
157+
echo "::error::supersetbot did not finish within ${call_timeout}s; it is most likely waiting out a GitHub API rate limit (see its 'retrying in N seconds' output above)" >&2
158+
rm -f "$out" "$err"
159+
return 1
160+
fi
151161
if [ "$attempt" -eq 3 ] ||
152162
! grep -q 'RequestError \[HttpError\]' "$err" ||
153163
! grep -Eq '^[[:space:]]*status: 5[0-9]{2},' "$err"; then
@@ -200,12 +210,12 @@ jobs:
200210
docker_command_for_platform() {
201211
local preset="$1" extra_flags="$2" platform="$3"
202212
shift 3
203-
DOCKERHUB_TOKEN= supersetbot docker \
213+
# Through supersetbot_dry_run so these calls get its 5xx retry.
214+
DOCKERHUB_TOKEN= supersetbot_dry_run \
204215
--preset "$preset" \
205216
--platform "$platform" \
206217
"$@" \
207-
--extra-flags "$extra_flags" \
208-
--dry-run
218+
--extra-flags "$extra_flags"
209219
}
210220
# One master publish job per platform (docker.yml's docker-build and
211221
# docker-build-arm64) asks the plan for its own platform.

0 commit comments

Comments
 (0)