From e6daff099d28d33bb2e23d687a4875cc8de08d81 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 28 May 2026 02:48:34 +0800 Subject: [PATCH] fix: ignore stale gitops artifact catalog --- scripts/g14-gitops-render.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/g14-gitops-render.mjs b/scripts/g14-gitops-render.mjs index b9bebc93..21d60a54 100644 --- a/scripts/g14-gitops-render.mjs +++ b/scripts/g14-gitops-render.mjs @@ -732,8 +732,13 @@ function prepareSourceScript() { "if git ls-remote --exit-code --heads origin \"$(params.gitops-branch)\" >/dev/null 2>&1; then", " git fetch --depth 1 origin \"$(params.gitops-branch)\" >/dev/null 2>&1 || true", " if git cat-file -e FETCH_HEAD:deploy/artifact-catalog.dev.json 2>/dev/null; then", - " git show FETCH_HEAD:deploy/artifact-catalog.dev.json > deploy/artifact-catalog.dev.json", - " echo '{\"event\":\"gitops-artifact-catalog\",\"phase\":\"prepare-source\",\"status\":\"loaded\",\"branch\":\"'\"$(params.gitops-branch)\"'\"}'", + " git show FETCH_HEAD:deploy/artifact-catalog.dev.json > /tmp/hwlab-gitops-artifact-catalog.dev.json", + " if node -e 'const fs=require(\"fs\"); const ids=(doc)=>(doc.services||[]).map((s)=>s.serviceId); const gitops=JSON.parse(fs.readFileSync(process.argv[1],\"utf8\")); const source=JSON.parse(fs.readFileSync(process.argv[2],\"utf8\")); if (JSON.stringify(ids(gitops)) !== JSON.stringify(ids(source))) process.exit(42);' /tmp/hwlab-gitops-artifact-catalog.dev.json deploy/artifact-catalog.dev.json; then", + " cp /tmp/hwlab-gitops-artifact-catalog.dev.json deploy/artifact-catalog.dev.json", + " echo '{\"event\":\"gitops-artifact-catalog\",\"phase\":\"prepare-source\",\"status\":\"loaded\",\"branch\":\"'\"$(params.gitops-branch)\"'\"}'", + " else", + " echo '{\"event\":\"gitops-artifact-catalog\",\"phase\":\"prepare-source\",\"status\":\"ignored-stale\",\"reason\":\"service-ids-mismatch\",\"branch\":\"'\"$(params.gitops-branch)\"'\"}'", + " fi", " else", " echo '{\"event\":\"gitops-artifact-catalog\",\"phase\":\"prepare-source\",\"status\":\"seed\",\"reason\":\"missing-on-gitops-branch\"}'", " fi",