diff --git a/ci/promote.sh b/ci/promote.sh index 51dabe0..41ffa2a 100755 --- a/ci/promote.sh +++ b/ci/promote.sh @@ -85,10 +85,12 @@ lines = [] def walk(prefix, node): for k, v in node.items(): key = f"{prefix}.{k}" if prefix else k - if isinstance(v, dict): - walk(key, v) + if not isinstance(v, dict): + continue + if "repository" in v and "tag" in v: + lines.append((key, v["repository"], v["tag"])) else: - lines.append((key, v.get("repository", ""), v.get("tag", ""))) + walk(key, v) walk("", images) out, skipped = [], [] for key, repo, tag in lines: @@ -98,7 +100,7 @@ for key, repo, tag in lines: sys.exit(f"[promote] 错误: demo image-version 中 {key} 缺 repository/tag") out.append(f"{repo} {tag}") open(dst, "w", encoding="utf-8").write("\n".join(out) + "\n") -print(f"[promote] 交付基线 {len(out)} 个镜像: " + ", ".join(r for r, _ in out)) +print(f"[promote] 交付基线 {len(out)} 个镜像: " + ", ".join(l.split()[0] for l in out)) if skipped: print(f"[promote] 跳过 protocol 镜像: {', '.join(skipped)}") PY