From ecd725fc1b58854abde6a419a4c5de2be5e8b1f7 Mon Sep 17 00:00:00 2001 From: Madraka <8898640+Madraka@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:57:15 +0300 Subject: [PATCH] ci(docker): wait until npm serves the whole release before building The 0.7.1 image build failed with ETARGET for @cloudhal/analytics@0.7.1. The publish job tags after waiting five minutes even when npm does not serve every package yet (scripts/publish-ci.ts), and npm registered analytics six minutes after its publish, a minute after the Docker build had started its npm install. The build job now polls npm view for every package of the release group (.changeset/config.json fixed[0]) at the version, every 30 s for up to 30 minutes, before it builds. No tag moves on a failure, as before. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Madraka <8898640+Madraka@users.noreply.github.com> --- .github/workflows/docker.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7f0b207a..428fdb1d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -93,6 +93,28 @@ jobs: echo "::error::version must be x.y.z (got '$VERSION')" exit 1 fi + # The publish job tags after five minutes even when npm does not serve every package yet + # (scripts/publish-ci.ts), and `npm install` in the image then fails with ETARGET (0.7.1: + # @cloudhal/analytics appeared six minutes after its publish). Wait, up to 30 minutes, until + # npm resolves every package of the release group at this version. + - name: Wait until npm serves the release + if: env.VERSION != '' + run: | + pkgs=$(jq -r '.fixed[0][]' .changeset/config.json) + for attempt in $(seq 1 60); do + missing="" + for p in $pkgs; do + [ "$(npm view "$p@$VERSION" version 2>/dev/null)" = "$VERSION" ] || missing="$missing $p" + done + if [ -z "$missing" ]; then + echo "npm serves every package of the release group at $VERSION" + exit 0 + fi + echo "waiting for:$missing (attempt $attempt of 60)" + sleep 30 + done + echo "::error::npm does not serve$missing at $VERSION after 30 minutes" + exit 1 # edge: the packages of this ref, built and packed the way the release job packs them - if: env.VERSION == ''