diff --git a/.tangled/workflows/deploy-docs.yml b/.tangled/workflows/deploy-docs.yml index 9ce35a7..66d09d1 100644 --- a/.tangled/workflows/deploy-docs.yml +++ b/.tangled/workflows/deploy-docs.yml @@ -34,12 +34,22 @@ steps: if [ -n "$INTERP" ]; then patchelf --set-interpreter "$INTERP" --set-rpath "$(dirname "$INTERP")" wisp-cli fi - # run to completion so wisp-cli's output flushes to the log, then fail - # loudly on its exit code — `set -e` here would abort mid-step and the - # error (e.g. auth failure) would never reach the log. - ./wisp-cli deploy "$WISP_HANDLE" --path ./site-out --site "$WISP_SITE_NAME" --password "$ATPROTO_PASSWORD" - rc=$? + # pds.zat.dev can transiently return InternalServerError while creating a + # session. Retry the idempotent/incremental deploy before failing the job. + rc=1 + for attempt in 1 2 3 4 5; do + ./wisp-cli deploy "$WISP_HANDLE" --path ./site-out --site "$WISP_SITE_NAME" --password "$ATPROTO_PASSWORD" + rc=$? + if [ "$rc" -eq 0 ]; then + break + fi + if [ "$attempt" -lt 5 ]; then + delay=$((attempt * 10)) + echo "wisp docs deploy attempt $attempt failed; retrying in ${delay}s" >&2 + sleep "$delay" + fi + done if [ "$rc" -ne 0 ]; then - echo "wisp docs deploy failed (wisp-cli exit $rc)" >&2 + echo "wisp docs deploy failed after 5 attempts (wisp-cli exit $rc)" >&2 exit "$rc" fi