diff --git a/Dockerfile.variant b/Dockerfile.variant index f5a6ae1..f39864f 100644 --- a/Dockerfile.variant +++ b/Dockerfile.variant @@ -50,16 +50,16 @@ ARG PI_OBSMEM_REPO=https://github.com/elpapi42/pi-observational-memory.git ARG PI_OBSMEM_REF=master RUN set -e && \ - git_clone_retry() { \ - url="$1"; ref="$2"; dest="$3"; \ - for i in 1 2 3 4 5; do \ - if git clone --depth 1 --branch "$ref" "$url" "$dest"; then return 0; fi; \ - rm -rf "$dest"; \ - echo "git clone $url failed (attempt $i/5), retrying in $((i*5))s..."; \ - sleep $((i*5)); \ - done; \ - return 1; \ - } && \ + # git_fetch_ref: clone-equivalent helper that accepts EITHER a branch name + # OR a commit SHA as $ref. Uses `git fetch + checkout FETCH_HEAD` + # which (a) works with both name and SHA forms uniformly, and (b) defeats + # the registry-buildcache footgun when CI passes a resolved SHA. The + # earlier helper `git_clone_retry` (using `git clone --branch`) only + # worked with branch names — a SHA-resolved build-arg made `git clone + # --branch <40-char-SHA>` fail with "Remote branch not found". Surfaced + # in pi-devbox v1.0.0-rerun (run 374) 2026-06-10 and fixed by switching + # all four clones to git_fetch_ref. Both Gitea and GitHub allow fetching + # arbitrary commits by default (uploadpack.allowReachableSHA1InWant). git_fetch_ref() { \ url="$1"; ref="$2"; dest="$3"; \ rm -rf "$dest"; mkdir -p "$dest"; \ @@ -77,8 +77,8 @@ RUN set -e && \ NPM_CONFIG_PREFIX=/usr npm install -g @earendil-works/pi-coding-agent@${PI_VERSION} ; \ fi && \ pi --version && \ - git_clone_retry https://gitea.jordbo.se/joakimp/pi-toolkit.git "${PI_TOOLKIT_REF}" /opt/pi-toolkit && \ - git_clone_retry https://gitea.jordbo.se/joakimp/pi-extensions.git "${PI_EXTENSIONS_REF}" /opt/pi-extensions && \ + git_fetch_ref "https://gitea.jordbo.se/joakimp/pi-toolkit.git" "${PI_TOOLKIT_REF}" /opt/pi-toolkit && \ + git_fetch_ref "https://gitea.jordbo.se/joakimp/pi-extensions.git" "${PI_EXTENSIONS_REF}" /opt/pi-extensions && \ git_fetch_ref "${PI_FORK_REPO}" "${PI_FORK_REF}" /opt/pi-fork && \ git_fetch_ref "${PI_OBSMEM_REPO}" "${PI_OBSMEM_REF}" /opt/pi-observational-memory && \ (cd /opt/pi-fork && npm install --omit=dev --no-audit --no-fund) && \