Skip to content

Commit 3878340

Browse files
committed
ci: 安装步骤加重试,一次 xlings update 可能静默返回陈旧索引
索引以 artifact 形式发布、由一个指针指向,而版本 bump 合入后指针是**异步** 传播的。发布当天实测:合入四分钟后跑的 update 打印了 `index updated`,随后 安装失败于 package 'mcpp@<ver>' not found in the synced index (xim@artifact:<更旧的 sha>, ...), synced 0 seconds ago 什么都没出错。那次 update 取到的是**上一个** artifact,而 「synced 0 seconds ago」说的是它什么时候被取的、不是它里面有什么——这正是 这条消息读起来像「很新」的原因。 所以这不是绕过抖动的重试,而是补上单次 update 并不执行的那段等待。钉了 一个从未发布过的版本仍然会失败,在最后一次尝试之后,并说明是两种情形中的 哪一种。
1 parent a4ec7a3 commit 3878340

1 file changed

Lines changed: 58 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,35 @@ jobs:
2626
2727
- name: Install mcpp
2828
run: |
29-
xlings update
30-
xlings install "mcpp@$MCPP_VERSION" -y -g
29+
# ⚠️ A LOOP, BECAUSE ONE `xlings update` CAN RETURN A STALE INDEX
30+
# WITHOUT SAYING SO.
31+
#
32+
# The index is published as an artifact behind a pointer, and that
33+
# pointer propagates asynchronously after a version bump is merged.
34+
# Measured on release day: an update run four minutes after the merge
35+
# printed `index updated`, and the install then failed with
36+
#
37+
# package 'mcpp@<ver>' not found in the synced index
38+
# (xim@artifact:<an older sha>, ...), synced 0 seconds ago
39+
#
40+
# Nothing had gone wrong. The update fetched the PREVIOUS artifact,
41+
# and "synced 0 seconds ago" describes when it was fetched rather than
42+
# what it contains — which is why the message reads as freshness.
43+
#
44+
# So this is not a retry around flakiness; it is the wait that a
45+
# single update does not perform. A pin naming a version that was
46+
# never published still fails, after the last attempt, and says which
47+
# of the two situations it is.
48+
for attempt in 1 2 3 4 5 6; do
49+
xlings update > /dev/null 2>&1 || true
50+
if xlings install "mcpp@$MCPP_VERSION" -y -g; then break; fi
51+
if [ "$attempt" = 6 ]; then
52+
echo "::error::mcpp@$MCPP_VERSION never appeared in the index (6 attempts over 5 minutes). If it was just released, the pointer has not propagated; if the pin names a version that was never published, it never will."
53+
exit 1
54+
fi
55+
echo "the index has not caught up yet (attempt $attempt of 6); waiting 60s"
56+
sleep 60
57+
done
3158
mcpp --version
3259
mcpp self config --mirror GLOBAL
3360
@@ -111,8 +138,35 @@ jobs:
111138
112139
- name: Install mcpp
113140
run: |
114-
xlings update
115-
xlings install "mcpp@$MCPP_VERSION" -y -g
141+
# ⚠️ A LOOP, BECAUSE ONE `xlings update` CAN RETURN A STALE INDEX
142+
# WITHOUT SAYING SO.
143+
#
144+
# The index is published as an artifact behind a pointer, and that
145+
# pointer propagates asynchronously after a version bump is merged.
146+
# Measured on release day: an update run four minutes after the merge
147+
# printed `index updated`, and the install then failed with
148+
#
149+
# package 'mcpp@<ver>' not found in the synced index
150+
# (xim@artifact:<an older sha>, ...), synced 0 seconds ago
151+
#
152+
# Nothing had gone wrong. The update fetched the PREVIOUS artifact,
153+
# and "synced 0 seconds ago" describes when it was fetched rather than
154+
# what it contains — which is why the message reads as freshness.
155+
#
156+
# So this is not a retry around flakiness; it is the wait that a
157+
# single update does not perform. A pin naming a version that was
158+
# never published still fails, after the last attempt, and says which
159+
# of the two situations it is.
160+
for attempt in 1 2 3 4 5 6; do
161+
xlings update > /dev/null 2>&1 || true
162+
if xlings install "mcpp@$MCPP_VERSION" -y -g; then break; fi
163+
if [ "$attempt" = 6 ]; then
164+
echo "::error::mcpp@$MCPP_VERSION never appeared in the index (6 attempts over 5 minutes). If it was just released, the pointer has not propagated; if the pin names a version that was never published, it never will."
165+
exit 1
166+
fi
167+
echo "the index has not caught up yet (attempt $attempt of 6); waiting 60s"
168+
sleep 60
169+
done
116170
mcpp --version
117171
mcpp self config --mirror GLOBAL
118172

0 commit comments

Comments
 (0)