fix(ci): pin-acr 也算正式发布——分配版本号并 bump chart(应用引用跟随),镜像仍钉所选 tag

此前 pin-acr 搭纯复用通路(无版本号、chart 不动);按门户语义修正:
选已有 tag 即一次正式发布,默认 auto-bump(+1)可指定,chart 仓 bump、
Application/平台文件引用跟随新 chart,镜像不搬运。

本地 PROMOTE_DRY_RUN 演练通过(mxlexus:v9.9.9,image my-tag-v2,
sso.yaml chart-v1.0.1 → chart-v9.9.9)
This commit is contained in:
ximenchuifeng committed 2026-09-08 12:41:29 +08:00
1 parent 8b4f3efa9f
commit eb44c30dbb
1 file changed
+6 -9
+6 -9
View File
@@ -33,10 +33,11 @@
# protocol mock 不进 PLAN,保留 PROMOTE_PROTOCOLS 独立开关
#
# 版本号分配:
# 有 deliver/ci-now(或 CHART_ONLY=true)→ 需要新版本号(RELEASE_VERSION 缺省 auto-bump);
# 有 deliver/ci-now/pin-acr(或 CHART_ONLY=true)→ 需要新版本号(RELEASE_VERSION 缺省 auto-bump);
# chart tag 已存在不再拒绝,记 CHART_TAG_EXISTS=true 复用(幂等,可同参数重跑/同版本发多客户)
# 全部 keep/reuse/pin-acr(纯复用发布)→ 不分配新版本号,chart 步骤跳过,
# reuse 服务 chart targetRevision 各指已有 chart-<version>;pin-acr 服务 chart 引用不动
# 全部 keep/reuse(纯复用发布)→ 不分配新版本号,chart 步骤跳过,
# reuse 服务 chart targetRevision 各指已有 chart-<version>
# pin-acr 也算正式发布:分配新版本号并 bump chart(应用引用跟随),镜像钉所选 tag 名
#
# 其他参数:
# CHART_ONLY=true 只发 chart:prepare 跳过镜像基线与 Harbor 校验,retag 整步跳过,
@@ -266,7 +267,7 @@ for e in entries:
plan_out = [norm.get(s) or {"service": s, "action": "keep",
"repos": REPOS[s], "keys": KEYS[s], "appFile": APPFILE[s]}
for s in ALL]
has_deliver = any(e["action"] in ("deliver", "ci-now") for e in plan_out)
has_deliver = any(e["action"] in ("deliver", "ci-now", "pin-acr") for e in plan_out)
# ── 3. DB_CHANGE 校验:逗号分隔服务名,须为本次非 keep 服务的子集 ──
db_change = [s.strip() for s in (os.environ.get("DB_CHANGE") or "").split(",") if s.strip()]
@@ -599,11 +600,7 @@ def retarget(path, new_ref, required):
return old_ref, new_ref
for e in actions:
if e["action"] == "pin-acr":
# pin-acr 只钉镜像 tag,chart 引用保持不变(values 变更即可触发 ArgoCD sync)
print(f"[promote] {e['service']}: chart 引用保持不变(pin-acr)")
continue
new_ref = CHART_TAG if e["action"] in ("deliver", "ci-now") else f"chart-{e['version']}"
new_ref = CHART_TAG if e["action"] in ("deliver", "ci-now", "pin-acr") else f"chart-{e['version']}"
r = retarget(os.path.join(appdir, e["appFile"]), new_ref, required=True)
if r:
chart_from[e["service"]], chart_to[e["service"]] = r