Skip to content

Commit 105038e

Browse files
ci: mirror Docker release images to Vercel registry (#120058)
* ci: publish release images to Vercel registry * ci: publish beta images to Vercel registry * fix(ci): allow beta Vercel dispatch * fix(ci): publish VCR-compatible image indexes * fix(ci): allow VCR readiness propagation * fix(ci): use Sandbox as VCR readiness proof * fix(ci): promote clean VCR channel indexes * fix(release): harden VCR publication * fix(release): bind VCR publishing to verified inputs * fix(test): follow script declaration migration * fix(release): isolate VCR mirroring * test(release): align VCR secret ownership
1 parent db879e7 commit 105038e

11 files changed

Lines changed: 5842 additions & 0 deletions

‎.github/release/vercel-cli/package-lock.json‎

Lines changed: 4344 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "openclaw-release-vercel-cli",
3+
"private": true,
4+
"version": "1.0.0",
5+
"dependencies": {
6+
"vercel": "58.4.4"
7+
}
8+
}

‎.github/workflows/docker-release.yml‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ on:
1111
description: Full immutable commit SHA resolved from tag
1212
required: true
1313
type: string
14+
outputs:
15+
version:
16+
description: Resolved Docker release version without the v prefix
17+
value: ${{ jobs.resolve_release_policy.outputs.version }}
18+
include_browser:
19+
description: Whether the tagged Docker release includes browser images
20+
value: ${{ jobs.create-manifest.outputs.browser_supported }}
21+
vcr_source_refs:
22+
description: Newline-delimited attestation-verified immutable GHCR source refs
23+
value: ${{ jobs.verify-attestations.outputs.vcr_source_refs }}
1424
secrets:
1525
DOCKERHUB_USERNAME:
1626
required: true
@@ -631,6 +641,8 @@ jobs:
631641
permissions:
632642
packages: write
633643
contents: read
644+
outputs:
645+
browser_supported: ${{ steps.tags.outputs.browser_supported }}
634646
steps:
635647
- name: Checkout
636648
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -687,6 +699,11 @@ jobs:
687699
exit 1
688700
fi
689701
{
702+
if [[ "${browser_supported}" == "1" ]]; then
703+
echo "browser_supported=true"
704+
else
705+
echo "browser_supported=false"
706+
fi
690707
echo "value<<EOF"
691708
printf "%s\n" "${tags[@]}" "${slim_tags[@]}"
692709
echo "EOF"
@@ -753,6 +770,8 @@ jobs:
753770
needs: [resolve_release_policy, resolve_build_provenance, create-manifest]
754771
if: ${{ always() && needs.create-manifest.result == 'success' }}
755772
runs-on: ubuntu-24.04
773+
outputs:
774+
vcr_source_refs: ${{ steps.vcr_source_refs.outputs.value }}
756775
permissions:
757776
contents: read
758777
packages: write
@@ -901,6 +920,56 @@ jobs:
901920
--platform linux/arm64 \
902921
"${dockerhub_arm64_refs[@]}"
903922
923+
# Resolve the moving release tags once, then verify the exact immutable
924+
# indexes that the VCR publisher will consume. Passing those digest refs
925+
# across the job boundary prevents a later tag rewrite from changing the
926+
# bytes copied after attestation verification.
927+
- name: Resolve and verify immutable VCR source refs
928+
id: vcr_source_refs
929+
shell: bash
930+
env:
931+
GHCR_IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
932+
INCLUDE_BROWSER: ${{ needs.create-manifest.outputs.browser_supported }}
933+
VERSION: ${{ needs.resolve_release_policy.outputs.version }}
934+
run: |
935+
set -euo pipefail
936+
aliases=(default slim)
937+
tags=("${VERSION}" "${VERSION}-slim")
938+
if [[ "${INCLUDE_BROWSER}" == "true" ]]; then
939+
aliases+=(browser)
940+
tags+=("${VERSION}-browser")
941+
fi
942+
943+
source_refs=()
944+
immutable_refs=()
945+
for index in "${!aliases[@]}"; do
946+
tagged_ref="${GHCR_IMAGE}:${tags[$index]}"
947+
descriptor="$(
948+
docker buildx imagetools inspect \
949+
"${tagged_ref}" \
950+
--format '{{json .Manifest}}'
951+
)"
952+
digest="$(
953+
jq -er \
954+
'.digest | select(type == "string" and test("^sha256:[a-f0-9]{64}$"))' \
955+
<<< "${descriptor}"
956+
)"
957+
immutable_ref="${GHCR_IMAGE}@${digest}"
958+
source_refs+=("${aliases[$index]}=${immutable_ref}")
959+
immutable_refs+=("${immutable_ref}")
960+
done
961+
962+
node scripts/verify-docker-attestations.mjs \
963+
--platform linux/amd64 \
964+
--platform linux/arm64 \
965+
"${immutable_refs[@]}"
966+
967+
{
968+
echo "value<<EOF"
969+
printf '%s\n' "${source_refs[@]}"
970+
echo "EOF"
971+
} >> "${GITHUB_OUTPUT}"
972+
904973
- name: Promote and verify channel aliases
905974
if: ${{ needs.resolve_release_policy.outputs.channel != 'beta' }}
906975
env:

‎.github/workflows/openclaw-release-publish.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,6 +2424,20 @@ jobs:
24242424
contents: read
24252425
packages: write
24262426

2427+
publish_vcr:
2428+
name: Mirror Docker images to Vercel Container Registry
2429+
needs: [publish_docker]
2430+
if: ${{ always() && needs.publish_docker.result == 'success' }}
2431+
uses: ./.github/workflows/vercel-container-registry-publish.yml
2432+
with:
2433+
include_browser: ${{ needs.publish_docker.outputs.include_browser == 'true' }}
2434+
source_refs: ${{ needs.publish_docker.outputs.vcr_source_refs }}
2435+
version: ${{ needs.publish_docker.outputs.version }}
2436+
secrets:
2437+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
2438+
permissions:
2439+
contents: read
2440+
24272441
finalize_github_release:
24282442
name: Finalize GitHub release
24292443
needs: [publish, publish_docker]
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
name: Vercel Container Registry Publish
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
description: Docker release version without the v prefix
8+
required: true
9+
type: string
10+
source_refs:
11+
description: Newline-delimited alias=immutable-ref entries verified by the caller
12+
required: true
13+
type: string
14+
include_browser:
15+
description: Whether the tagged Docker release includes browser images
16+
required: true
17+
type: boolean
18+
secrets:
19+
VERCEL_TOKEN:
20+
required: true
21+
22+
env:
23+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
24+
NODE_VERSION: "24.15.0"
25+
26+
concurrency:
27+
# Alias promotion is read-then-write. Serialize VCR independently so a slow
28+
# mirror never holds the Docker publication lock.
29+
group: vcr-release-publish
30+
cancel-in-progress: false
31+
32+
jobs:
33+
publish:
34+
runs-on: ubuntu-24.04
35+
timeout-minutes: 30
36+
# VCR is a best-effort mirror. Failed steps remain visible, but the primary
37+
# Docker publication and GitHub release finalization must continue.
38+
continue-on-error: true
39+
permissions:
40+
contents: read
41+
steps:
42+
- name: Checkout trusted registry tooling
43+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
44+
with:
45+
ref: ${{ github.sha }}
46+
persist-credentials: false
47+
48+
- name: Set up Docker Builder
49+
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
50+
51+
- name: Setup trusted Node runtime
52+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
53+
with:
54+
node-version: ${{ env.NODE_VERSION }}
55+
56+
# Materialize the complete CLI dependency closure before the production
57+
# token enters any step environment. The committed lock and integrity
58+
# checks keep registry and Sandbox operations on reviewed executable code.
59+
- name: Materialize locked Vercel CLI
60+
id: vercel_cli
61+
run: |
62+
set -euo pipefail
63+
bash scripts/materialize-vercel-cli.sh \
64+
.github/release/vercel-cli \
65+
"${RUNNER_TEMP}/vercel-cli" \
66+
"${GITHUB_OUTPUT}"
67+
68+
- name: Validate Vercel Container Registry configuration
69+
env:
70+
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID }}
71+
VERCEL_SCOPE: ${{ vars.VERCEL_SCOPE }}
72+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
73+
VERCEL_VCR_IMAGE: ${{ vars.VERCEL_VCR_IMAGE }}
74+
run: |
75+
set -euo pipefail
76+
for name in VERCEL_PROJECT_ID VERCEL_SCOPE VERCEL_TOKEN VERCEL_VCR_IMAGE; do
77+
if [[ -z "${!name}" ]]; then
78+
echo "::error::${name} is required for Vercel Container Registry publishing."
79+
exit 1
80+
fi
81+
done
82+
if [[ "${VERCEL_VCR_IMAGE}" != vcr.vercel.com/*/*/* ]]; then
83+
echo "::error::VERCEL_VCR_IMAGE must be a full vcr.vercel.com/team/project/repository image name."
84+
exit 1
85+
fi
86+
87+
- name: Authenticate Docker to Vercel Container Registry
88+
env:
89+
VERCEL_CLI: ${{ steps.vercel_cli.outputs.cli }}
90+
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID }}
91+
VERCEL_SCOPE: ${{ vars.VERCEL_SCOPE }}
92+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
93+
run: |
94+
set -euo pipefail
95+
"${VERCEL_CLI}" vcr login docker \
96+
--project "${VERCEL_PROJECT_ID}" \
97+
--scope "${VERCEL_SCOPE}" \
98+
--format json
99+
100+
- name: Copy and verify immutable release images
101+
id: copy_images
102+
env:
103+
INCLUDE_BROWSER: ${{ inputs.include_browser }}
104+
SOURCE_REFS: ${{ inputs.source_refs }}
105+
TARGET_IMAGE: ${{ vars.VERCEL_VCR_IMAGE }}
106+
VERSION: ${{ inputs.version }}
107+
run: |
108+
set -euo pipefail
109+
browser_args=()
110+
if [[ "${INCLUDE_BROWSER}" == "true" ]]; then
111+
browser_args+=(--include-browser)
112+
fi
113+
source_ref_args=()
114+
while IFS= read -r source_ref; do
115+
[[ -z "${source_ref}" ]] && continue
116+
source_ref_args+=(--source-ref "${source_ref}")
117+
done <<< "${SOURCE_REFS}"
118+
node scripts/vercel-container-registry-publish.mjs \
119+
--version "${VERSION}" \
120+
"${source_ref_args[@]}" \
121+
--target-image "${TARGET_IMAGE}" \
122+
"${browser_args[@]}"
123+
124+
# VCR tag status can remain null after an image is usable, so Sandbox
125+
# creation is the authoritative readiness check for this publication.
126+
- name: Run custom-image Sandbox smoke
127+
id: sandbox_smoke
128+
env:
129+
VERCEL_AUTH_TOKEN: ${{ secrets.VERCEL_TOKEN }}
130+
VERCEL_CLI: ${{ steps.vercel_cli.outputs.cli }}
131+
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID }}
132+
VERCEL_SCOPE: ${{ vars.VERCEL_SCOPE }}
133+
VERCEL_VCR_IMAGE: ${{ vars.VERCEL_VCR_IMAGE }}
134+
VERSION: ${{ inputs.version }}
135+
run: |
136+
set -euo pipefail
137+
repository="${VERCEL_VCR_IMAGE##*/}"
138+
retry_deadline=$((SECONDS + 600))
139+
attempt=1
140+
while true; do
141+
set +e
142+
output="$(
143+
"${VERCEL_CLI}" sandbox run \
144+
--silent \
145+
--rm \
146+
--non-persistent \
147+
--network-policy deny-all \
148+
--timeout 3m \
149+
--project "${VERCEL_PROJECT_ID}" \
150+
--scope "${VERCEL_SCOPE}" \
151+
--image "${repository}:${VERSION}" \
152+
--workdir /app \
153+
--env "EXPECTED_VERSION=${VERSION}" \
154+
-- /bin/sh -lc 'test "$(node -p "require(\"./package.json\").version")" = "${EXPECTED_VERSION}" && node openclaw.mjs --version' \
155+
2>&1
156+
)"
157+
status=$?
158+
set -e
159+
printf '%s\n' "${output}"
160+
if [[ "${status}" -eq 0 ]]; then
161+
break
162+
fi
163+
if [[ "${output}" != *"image_not_ready"* ]]; then
164+
exit "${status}"
165+
fi
166+
if (( SECONDS >= retry_deadline )); then
167+
echo "::error::Vercel image preparation remained image_not_ready for 10 minutes."
168+
exit "${status}"
169+
fi
170+
delay=10
171+
remaining=$((retry_deadline - SECONDS))
172+
if (( delay > remaining )); then
173+
delay="${remaining}"
174+
fi
175+
echo "::notice::Vercel image is not ready; retrying Sandbox smoke in ${delay}s (attempt ${attempt})."
176+
sleep "${delay}"
177+
attempt=$((attempt + 1))
178+
done
179+
180+
- name: Promote and verify channel aliases
181+
id: promote_aliases
182+
env:
183+
INCLUDE_BROWSER: ${{ inputs.include_browser }}
184+
TARGET_IMAGE: ${{ vars.VERCEL_VCR_IMAGE }}
185+
VERSION: ${{ inputs.version }}
186+
run: |
187+
set -euo pipefail
188+
browser_args=()
189+
if [[ "${INCLUDE_BROWSER}" == "true" ]]; then
190+
browser_args+=(--include-browser)
191+
fi
192+
node scripts/vercel-container-registry-publish.mjs \
193+
--version "${VERSION}" \
194+
--target-image "${TARGET_IMAGE}" \
195+
--promote-aliases \
196+
"${browser_args[@]}"
197+
198+
- name: Summarize Vercel publication
199+
if: ${{ always() }}
200+
env:
201+
COPY_OUTCOME: ${{ steps.copy_images.outcome }}
202+
INCLUDE_BROWSER: ${{ inputs.include_browser }}
203+
PROMOTE_OUTCOME: ${{ steps.promote_aliases.outcome }}
204+
SMOKE_OUTCOME: ${{ steps.sandbox_smoke.outcome }}
205+
TARGET_IMAGE: ${{ vars.VERCEL_VCR_IMAGE }}
206+
VERSION: ${{ inputs.version }}
207+
run: |
208+
variants="default, slim"
209+
if [[ "${INCLUDE_BROWSER}" == "true" ]]; then
210+
variants="${variants}, browser"
211+
fi
212+
status="passed"
213+
if [[ "${COPY_OUTCOME}" != "success" || "${SMOKE_OUTCOME}" != "success" || "${PROMOTE_OUTCOME}" != "success" ]]; then
214+
status="failed (non-blocking)"
215+
echo "::warning::VCR mirror failed; Docker publication and GitHub release finalization are unaffected."
216+
fi
217+
{
218+
echo "## Vercel Container Registry"
219+
echo "- Image: ${TARGET_IMAGE}:${VERSION}"
220+
echo "- Variants: ${variants}"
221+
echo "- Platforms: linux/amd64, linux/arm64"
222+
echo "- Status: ${status}"
223+
echo "- Copy: ${COPY_OUTCOME}"
224+
echo "- Sandbox smoke: ${SMOKE_OUTCOME}"
225+
echo "- Alias promotion: ${PROMOTE_OUTCOME}"
226+
} >> "${GITHUB_STEP_SUMMARY}"

0 commit comments

Comments
 (0)