Skip to content

fix(sync): never re-push unchanged images to docker.io (dest live-inspect fallback + old cache format transition) - #154

Merged
Goalina merged 1 commit into
mainfrom
fix/no-repush-guarantee
Nov 26, 2026
Merged

Goalina merged 1 commit into
mainfrom
fix/no-repush-guarantee

Conversation

@Goalina

@Goalina Goalina commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

背景(事故)

#153 修 mindie 前缀碰撞时把缓存 key 分隔符从 - 改成 #,导致所有旧格式缓存条目失配 → 冷启动 → docker.io 目的地跳过逻辑只信缓存 → 今天 11:25~11:50 对 35 个 docker.io/ascendai/* 仓库约 965 个 tag 全量重 PUT manifest(digest 未变,但 Docker Hub last_updated 时间戳被刷新一次)。

教训:老逻辑其实不会重推(主 key 前缀匹配一直在生效,我最初"缓存从未生效"的诊断有误);#153 的方案选错了——应该渐进迁移而不是格式干净切换。已在 11:57 取消了正在冷推 docker.io/ascendai/cann(937 tag)的 job(取消时还在 swr skip 阶段,0 个重推),pending 的 vllm-ascend/triton/manylinux 冷推 job 也一并取消。

修复(两道防线)

1. dest 实时兜底(硬保证,核心)

docker.io 目的地缓存未命中(冷启动/淘汰/格式迁移)时,不再直接 copy,而是先实时 inspect dest:

  • digest 一致 → ⏭️ Skip (dest digest match; cache healed),跳过并回写缓存自愈
  • dest 无此 tag / digest 不同(源真变了)→ 才走 copy
  • inspect 失败 → 跳过不 copy(沿用 quay/swr 路径的安全语义)

从此不变式成立:重 PUT manifest 只发生在 dest 缺 tag 或 digest 确实不同时。缓存从"正确性依据"降级为"性能优化"——缓存坏了最多多几次 API 调用,绝不会重推未变更的镜像、不会刷新时间戳。

2. 旧缓存格式过渡(消除存量冷启动)

restore-keys 增加第二行旧格式前缀:

restore-keys: |
  digest-cache-${{ matrix.src }}#     # 新格式优先
  digest-cache-${{ matrix.src }}-     # 回退 #153 之前的旧条目,避免迁移期冷启动

尚未重建新缓存的 src(cann / vllm-ascend / triton / manylinux 等)恢复命中旧条目 → 不再冷推。mindie 的旧格式回退可能取错归档(原 bug),但文件名对不上会回落空缓存,再由防线 1 的实时兜底接住——不重推。

验证

  • YAML 解析 + restore-keys 结构断言
  • 同步脚本 bash -n 语法检查
  • 合入后观察首个 run:cann/vllm-ascend/triton/manylinux 的 docker.io 目的地应全部 Skip (dest digest match; cache healed) 或 Skip (cache),0 synced

请求尽快合入

下一次定时触发在 12:23 UTC(20:23 北京)。合入前触发的话,cann 等未重建缓存的 src 还会冷推一次;合入后此风险结构性消除。

…pect fallback + old cache format transition)
@Goalina
Goalina merged commit 3821414 into main Nov 26, 2026
1 check passed
@Goalina

Goalina commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

review 补充:Docker Hub 拉取配额保护

日志证实配额为 ratelimit-remaining: 200;w=3600(200 次/小时,全仓库共享;sglang 从 docker.io 拉源同池)。两个关键事实:

  1. manifest PUT 不消耗配额(今天重推 965 tag 期间 remaining 始终 200,PUT/HEAD 不算 pull)——所以历史重推的代价是时间戳而非配额
  2. 兜底 inspect 的 GET 计入配额(每 tag 1 次)——大 src 冷启动(cann 937 tag)裸跑兜底会撞额度并连累 docker.io 源头的同步

已加配额预算(fbe3e57):

  • DEST_INSPECT_BUDGET(默认 150,留 50/h 给 docker.io 源头拉取)
  • 超预算的 tag 本轮不验证也不 copy(Skip (dest inspect budget exhausted this run; retry next run)),下一轮继续——缓存跨轮增量自愈,全程不重推
  • 结束时打印 Dest inspect budget: used X/Y; N tag(s) deferred
  • 不触发 job 失败(deferred 不是错误)

冷恢复收敛速度:cann 全缓存丢失时约 937/150 ≈ 7 轮(小时级)恢复;日常路径(缓存热)兜底零调用、零配额消耗。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant