:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(ci): pull depot docker hub images from mirror.gcr.io (#105127)
Raúl Negrón-Oterofb6f54721c9c
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.ymlindex ec8dfc60912d..f8523a28ea8f 100644--- a/.depot/workflows/ci-backend.yml+++ b/.depot/workflows/ci-backend.yml@@ -87,6 +87,9 @@# - Three data-modeling tests deselected (Depot-only MinIO 403 quarantine)# - COMPOSE_PROJECT_NAME pinned to posthog because bin/wait-for-docker filters by that# project name and checkout directory names are not stable across CI providers+# - WAIT_FOR_DOCKER_REGISTRY_MIRROR makes bin/ci-wait-for-docker launch pull Docker Hub+# images from mirror.gcr.io before `compose up`. Token requests to auth.docker.io time out+# intermittently from Depot CI sandboxes, and one failed pull leaves the whole stack missing.# - Compose launches run under `nohup` with stdin, stdout and stderr redirected to# $RUNNER_TEMP/compose-launch.log. Depot ends a step's background processes and closes its# output pipes when the step shell exits, so a plain `&` launch dies before it creates any@@ -158,6 +161,7 @@ env:HYPOTHESIS_CONSTANTS_EPOCH: v1SECRET_KEY: '6b01eee4f945ca25045b5aab440b953461faf08693a9abbf1166dc7c6b9772da' # unsafe - for testing onlyCOMPOSE_PROJECT_NAME: posthog+ WAIT_FOR_DOCKER_REGISTRY_MIRROR: mirror.gcr.ioDATABASE_URL: 'postgres://posthog:posthog@localhost:5432/posthog'REDIS_URL: 'redis://localhost'CLICKHOUSE_HOST: 'localhost'diff --git a/bin/ci-wait-for-docker b/bin/ci-wait-for-dockerindex 5b62c459d064..75b914495a7b 100755--- a/bin/ci-wait-for-docker+++ b/bin/ci-wait-for-docker@@ -23,6 +23,11 @@ COMPOSE_WAIT_TIMEOUT="${WAIT_FOR_COMPOSE_TIMEOUT:-600}"# timeout leaves the whole stack missing.LAUNCH_RETRIES="${WAIT_FOR_DOCKER_LAUNCH_RETRIES:-3}"LAUNCH_RETRY_DELAY="${WAIT_FOR_DOCKER_LAUNCH_RETRY_DELAY:-5}"+# Registry that mirrors Docker Hub, such as mirror.gcr.io. When set, launch pulls each Docker+# Hub image from it and tags it with the Docker Hub name, so `compose up` finds the image+# locally and never asks auth.docker.io for a token. The daemon config stays untouched, so+# Docker Hub credentials are never sent to the mirror.+REGISTRY_MIRROR="${WAIT_FOR_DOCKER_REGISTRY_MIRROR:-}"usage() {cat <<'EOF'@@ -164,6 +169,28 @@ missing_services() {printf '%s\n' "${missing[@]}"}+pull_from_registry_mirror() {+ local image+ local path+ local host++ [ -n "$REGISTRY_MIRROR" ] || return 0+ while read -r image; do+ path="${image#docker.io/}"+ host="${path%%/*}"+ # Digest-pinned images and images from other registries (ghcr.io, quay.io) pull as usual.+ if [[ "$path" == *@* ]] \+ || [[ "$path" == "$image" && "$path" == */* && ( "$host" == *[.:]* || "$host" == localhost ) ]]; then+ continue+ fi+ [[ "$path" == */* ]] || path="library/${path}"+ # A miss leaves the image for `compose up` to pull from Docker Hub.+ { docker pull -q "${REGISTRY_MIRROR}/${path}" >/dev/null 2>&1 \+ && docker tag "${REGISTRY_MIRROR}/${path}" "$image"; } &+ done < <(compose config --images "$@" 2>/dev/null)+ wait+}+run_launch_once() {local down_mode="$1"shift@@ -183,6 +210,7 @@ run_launch_once() {;;esac+ pull_from_registry_mirror "$@"compose_up "$@"}