From bd174d8186da23fc631cf4e5c3a9771cff33c264 Mon Sep 17 00:00:00 2001 From: copilotcoder Date: Tue, 7 Jul 2026 19:22:29 -0400 Subject: [PATCH] Harden E2E tester build against transient MCR DNS failures --- .gitea/workflows/cicd.yaml | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/cicd.yaml b/.gitea/workflows/cicd.yaml index c5266c7..2b470c5 100644 --- a/.gitea/workflows/cicd.yaml +++ b/.gitea/workflows/cicd.yaml @@ -831,6 +831,40 @@ jobs: run: | set -euo pipefail + PLAYWRIGHT_BASE_IMAGE="mcr.microsoft/playwright:v1.56.1-jammy" + + retry_pull_with_dns_probe() { + image_ref="$1" + attempts="${2:-6}" + backoff="${3:-5}" + attempt=1 + + while [ "${attempt}" -le "${attempts}" ]; do + echo "base pull attempt ${attempt}/${attempts} for ${image_ref}" + + if getent hosts mcr.microsoft >/dev/null 2>&1; then + echo "mcr.microsoft DNS resolution: ok" + else + echo "mcr.microsoft DNS resolution: failed" + fi + + timeout 10 curl -fsSIL "https://mcr.microsoft/v2/" >/dev/null || true + + if docker pull "${image_ref}"; then + return 0 + fi + + if [ "${attempt}" -lt "${attempts}" ]; then + sleep_seconds=$((backoff * attempt)) + echo "Retrying base image pull in ${sleep_seconds}s" + sleep "${sleep_seconds}" + fi + attempt=$((attempt + 1)) + done + + return 1 + } + retry_registry_op() { op_name="$1" image_ref="$2" @@ -865,7 +899,8 @@ jobs: E2E_TESTER_REPO="${GITEA_REGISTRY}/darkhelm.org/plex-playlist-e2e" E2E_TESTER_TAG_REF="${E2E_TESTER_REPO}:${HEAD_SHA}" - docker build -f Dockerfile.e2e-tester -t plex-playlist-e2e:"${HEAD_SHA}" . + retry_pull_with_dns_probe "${PLAYWRIGHT_BASE_IMAGE}" 6 5 + DOCKER_BUILDKIT=0 docker build --pull=false -f Dockerfile.e2e-tester -t plex-playlist-e2e:"${HEAD_SHA}" . docker tag plex-playlist-e2e:"${HEAD_SHA}" "${E2E_TESTER_TAG_REF}" retry_registry_op push "${E2E_TESTER_TAG_REF}" 5 4