Skip to content

Commit 267e72e

Browse files
committed
fix(cl): heal missing refs/cl links that blocked merge
Merge failed with "CL ref not found" when the mega_cl row and refs/cl/* got out of sync (empty pack, web-edit updates, or orphaned link). Ensure the canonical CL ref exists (adopting matching orphans), keep push/edit paths writing save_or_update_cl_ref, and cover the heal path with unit tests.
1 parent 8f7cdac commit 267e72e

50 files changed

Lines changed: 2361 additions & 423 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Temporary smoke test for docker buildx type=gha + actions: write.
2+
# Delete after: this file + tmp/gha-cache-smoke/
3+
#
4+
# Requires both:
5+
# 1) permissions.actions: write
6+
# 2) crazy-max/ghaction-github-runtime (exposes ACTIONS_RUNTIME_TOKEN /
7+
# ACTIONS_RESULTS_URL to raw `docker buildx` in run: steps)
8+
name: GHA cache smoke
9+
10+
on:
11+
push:
12+
branches:
13+
- main
14+
paths:
15+
- ".github/workflows/gha-cache-smoke.yml"
16+
- "tmp/gha-cache-smoke/**"
17+
18+
permissions:
19+
contents: read
20+
actions: write
21+
22+
concurrency:
23+
group: gha-cache-smoke
24+
cancel-in-progress: true
25+
26+
env:
27+
CACHE_SCOPE: gha-cache-smoke
28+
29+
jobs:
30+
export-cache:
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 10
33+
permissions:
34+
contents: read
35+
actions: write
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v3
41+
42+
# Raw `docker buildx --cache-to type=gha` needs these env vars; they are
43+
# NOT visible to run: steps unless exposed (build-push-action does this
44+
# internally). Without them, cache-to silently no-ops.
45+
- name: Expose GitHub Actions runtime env
46+
uses: crazy-max/ghaction-github-runtime@v3
47+
48+
- name: Build and export GHA cache
49+
run: |
50+
set -euo pipefail
51+
echo "ACTIONS_RUNTIME_TOKEN set: ${ACTIONS_RUNTIME_TOKEN:+yes}"
52+
echo "ACTIONS_CACHE_URL set: ${ACTIONS_CACHE_URL:+yes}"
53+
echo "ACTIONS_RESULTS_URL set: ${ACTIONS_RESULTS_URL:+yes}"
54+
if [ -z "${ACTIONS_RUNTIME_TOKEN:-}" ]; then
55+
echo "::error::ACTIONS_RUNTIME_TOKEN still empty after ghaction-github-runtime"
56+
exit 1
57+
fi
58+
59+
docker buildx build \
60+
--progress=plain \
61+
--provenance=false \
62+
--sbom=false \
63+
--cache-from type=gha,scope=$CACHE_SCOPE \
64+
--cache-to type=gha,mode=max,scope=$CACHE_SCOPE \
65+
--output type=docker,dest=/tmp/gha-cache-smoke.tar \
66+
-f tmp/gha-cache-smoke/Dockerfile \
67+
tmp/gha-cache-smoke \
68+
2>&1 | tee /tmp/export.log
69+
70+
if ! grep -Eiq 'exporting (to GitHub Actions Cache|cache)|writing cache' /tmp/export.log; then
71+
echo "::error::Expected GHA cache export markers missing from build log"
72+
echo "---- log ----"
73+
cat /tmp/export.log
74+
exit 1
75+
fi
76+
echo "OK: saw GHA cache export activity"
77+
grep -Ein 'exporting (to GitHub Actions Cache|cache)|writing cache' /tmp/export.log || true
78+
79+
- name: Assert cache entries exist via API
80+
env:
81+
GH_TOKEN: ${{ github.token }}
82+
run: |
83+
set -euo pipefail
84+
keys=$(gh api "repos/${{ github.repository }}/actions/caches?per_page=100" \
85+
--jq '[.actions_caches[].key] | map(select(test("gha-cache-smoke|buildx";"i")))')
86+
echo "matching cache keys: $keys"
87+
count=$(echo "$keys" | jq 'length')
88+
if [ "$count" -lt 1 ]; then
89+
echo "::error::No Actions cache entries after export"
90+
gh api "repos/${{ github.repository }}/actions/caches?per_page=20" \
91+
--jq '.actions_caches[] | {key, size_in_bytes, created_at}'
92+
exit 1
93+
fi
94+
echo "OK: $count cache key(s) present"
95+
96+
import-cache:
97+
needs: export-cache
98+
runs-on: ubuntu-latest
99+
timeout-minutes: 10
100+
permissions:
101+
contents: read
102+
actions: write
103+
steps:
104+
- uses: actions/checkout@v4
105+
106+
- name: Set up Docker Buildx
107+
uses: docker/setup-buildx-action@v3
108+
109+
- name: Expose GitHub Actions runtime env
110+
uses: crazy-max/ghaction-github-runtime@v3
111+
112+
- name: Build and require GHA cache import / layer CACHED
113+
run: |
114+
set -euo pipefail
115+
docker buildx build \
116+
--progress=plain \
117+
--provenance=false \
118+
--sbom=false \
119+
--cache-from type=gha,scope=$CACHE_SCOPE \
120+
--cache-to type=gha,mode=max,scope=$CACHE_SCOPE \
121+
--output type=docker,dest=/tmp/gha-cache-smoke.tar \
122+
-f tmp/gha-cache-smoke/Dockerfile \
123+
tmp/gha-cache-smoke \
124+
2>&1 | tee /tmp/import.log
125+
126+
if ! grep -Eiq 'importing cache|CACHED' /tmp/import.log; then
127+
echo "::error::No importing cache / CACHED markers — type=gha import failed"
128+
echo "---- log ----"
129+
cat /tmp/import.log
130+
exit 1
131+
fi
132+
echo "OK: GHA cache import/CACHED confirmed"
133+
grep -Ein 'importing cache|CACHED' /tmp/import.log || true

.github/workflows/mono-engine-deploy.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ env:
2222
IMAGE_TAG_BASE: latest
2323
HARBOR_REGISTRY: registry.xuanwu.openatom.cn
2424

25-
# Using AWS access key for authentication
25+
# Using AWS access key for authentication.
26+
# actions: write is required for docker buildx --cache-{from,to} type=gha.
2627
permissions:
2728
id-token: write
2829
contents: read
30+
actions: write
2931

3032
concurrency:
3133
group: ${{ github.workflow }}-${{ github.ref }}
@@ -42,6 +44,11 @@ jobs:
4244
- name: Set up Docker Buildx
4345
uses: docker/setup-buildx-action@v3
4446

47+
# Expose ACTIONS_RUNTIME_TOKEN / ACTIONS_RESULTS_URL for raw
48+
# `docker buildx --cache-{from,to} type=gha` in the build step.
49+
- name: Expose GitHub Actions runtime env
50+
uses: crazy-max/ghaction-github-runtime@v3
51+
4552
# -----------------------------
4653
# AWS / ECR Public
4754
# -----------------------------
@@ -80,12 +87,10 @@ jobs:
8087
8188
ECR_IMAGE="$ECR_REGISTRY/${{ env.REGISTRY_ALIAS }}/${{ env.REPOSITORY }}:$IMAGE_TAG"
8289
HARBOR_IMAGE="${{ env.HARBOR_REGISTRY }}/${{ env.REPOSITORY }}:$IMAGE_TAG"
83-
ECR_CACHE_IMAGE="$ECR_REGISTRY/${{ env.REGISTRY_ALIAS }}/${{ env.REPOSITORY }}:buildcache-${ARCH_SUFFIX}"
8490
CACHE_SCOPE="mono-engine-${ARCH_SUFFIX}"
8591
8692
echo "ECR_IMAGE=$ECR_IMAGE"
8793
echo "HARBOR_IMAGE=$HARBOR_IMAGE"
88-
echo "ECR_CACHE_IMAGE=$ECR_CACHE_IMAGE"
8994
echo "CACHE_SCOPE=$CACHE_SCOPE"
9095
9196
docker buildx build \

.github/workflows/orion-server-deploy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ env:
1313
IMAGE_TAG_BASE: latest
1414
HARBOR_REGISTRY: registry.xuanwu.openatom.cn
1515

16+
# actions: write is required for docker buildx --cache-{from,to} type=gha.
1617
permissions:
1718
id-token: write
1819
contents: read
20+
actions: write
1921

2022
concurrency:
2123
group: ${{ github.workflow }}-${{ github.ref }}
@@ -28,13 +30,19 @@ jobs:
2830
permissions:
2931
id-token: write
3032
contents: read
33+
actions: write
3134

3235
steps:
3336
- name: Checkout
3437
uses: actions/checkout@v4
3538
- name: Set up Docker Buildx
3639
uses: docker/setup-buildx-action@v3
3740

41+
# Expose ACTIONS_RUNTIME_TOKEN / ACTIONS_RESULTS_URL for raw
42+
# `docker buildx --cache-{from,to} type=gha` in the build step.
43+
- name: Expose GitHub Actions runtime env
44+
uses: crazy-max/ghaction-github-runtime@v3
45+
3846
# -----------------------------
3947
# AWS auth
4048
# -----------------------------

.github/workflows/web-deploy.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ env:
1515
IMAGE_VERSION: latest
1616
HARBOR_REGISTRY: registry.xuanwu.openatom.cn
1717

18+
# actions: write is required for docker buildx --cache-{from,to} type=gha.
1819
permissions:
1920
id-token: write
2021
contents: read
22+
actions: write
2123

2224
concurrency:
2325
group: ${{ github.workflow }}-${{ github.ref }}
@@ -39,16 +41,18 @@ jobs:
3941
permissions:
4042
id-token: write
4143
contents: read
44+
actions: write
4245
steps:
4346
- uses: actions/checkout@v4
4447

45-
- uses: actions/setup-node@v4
46-
with:
47-
node-version: "20"
48-
4948
- name: Set up Docker Buildx
5049
uses: docker/setup-buildx-action@v3
5150

51+
# Expose ACTIONS_RUNTIME_TOKEN / ACTIONS_RESULTS_URL for raw
52+
# `docker buildx --cache-{from,to} type=gha` in the build step.
53+
- name: Expose GitHub Actions runtime env
54+
uses: crazy-max/ghaction-github-runtime@v3
55+
5256
- name: Configure AWS Credentials (ECR Public, us-east-1)
5357
uses: aws-actions/configure-aws-credentials@v4
5458
with:
@@ -88,6 +92,7 @@ jobs:
8892
8993
docker buildx build \
9094
--platform "$PLATFORM" \
95+
--build-arg TIPTAP_PRIVATE_REGISTRY_KEY="$TIPTAP_PRIVATE_REGISTRY_KEY" \
9196
--cache-from type=gha,scope=mega-ui \
9297
--cache-to type=gha,mode=max,scope=mega-ui \
9398
--provenance=false \

0 commit comments

Comments
 (0)