fix: keep G14 generated state on gitops branch

This commit is contained in:
Codex
2026-05-27 10:14:24 +08:00
parent 278bbe1c6a
commit 336a9b2c2c
10 changed files with 188 additions and 154 deletions
@@ -1186,7 +1186,7 @@ function nextCommands({ canPublish, canApply, blockedReasons }) {
return [
"node scripts/deploy-desired-state-plan.mjs --target-ref origin/main --pretty",
"node scripts/deploy-desired-state-plan.mjs --promotion-commit <origin-main-sha> --check",
"node scripts/g14-gitops-render.mjs --check",
"node scripts/g14-gitops-render.mjs --no-write",
guardCommand
];
}
@@ -1199,7 +1199,7 @@ function nextCommands({ canPublish, canApply, blockedReasons }) {
];
}
return [
"node scripts/g14-gitops-render.mjs --check",
"node scripts/g14-gitops-render.mjs --no-write",
"node scripts/artifact-runtime-readiness-guard.mjs --target-ref origin/main --check --live --no-report"
];
}
+9 -4
View File
@@ -101,7 +101,9 @@ export async function createG14CiPlan(options = {}) {
...runtimeDepMatches,
...buildSystemMatches
].filter((item) => !isTestOnlyPath(item) && !isDocsOnlyPath(item)));
const affected = imageRelevantChangedPaths.length > 0;
const catalogRecord = catalogByServiceId.get(model.serviceId) ?? null;
const catalogReuse = reuseCandidate(catalogRecord, imageRelevantChangedPaths.length > 0);
const affected = imageRelevantChangedPaths.length > 0 || catalogReuse.status === "candidate-no-catalog" || catalogReuse.status === "candidate-unverified-digest";
const componentInputPaths = uniqueSorted([
...model.componentPaths,
...model.sharedPaths,
@@ -119,7 +121,6 @@ export async function createG14CiPlan(options = {}) {
runtimeKind: model.runtimeKind,
entrypoint: model.entrypoint
});
const catalogRecord = catalogByServiceId.get(model.serviceId) ?? null;
services.push({
serviceId: model.serviceId,
runtimeKind: model.runtimeKind,
@@ -136,7 +137,9 @@ export async function createG14CiPlan(options = {}) {
buildArgsHash,
changedPaths: imageRelevantChangedPaths,
affected,
reason: affected ? reasonForService({ directMatches, sharedMatches, runtimeDepMatches, buildSystemMatches }) : reasonForUnchanged(globalChange),
reason: affected
? reasonForService({ directMatches, sharedMatches, runtimeDepMatches, buildSystemMatches, catalogReuse })
: reasonForUnchanged(globalChange),
reuse: reuseCandidate(catalogRecord, affected)
});
}
@@ -315,12 +318,14 @@ async function gitValue(repoRoot, args) {
return result.stdout.trim();
}
function reasonForService({ directMatches, sharedMatches, runtimeDepMatches, buildSystemMatches }) {
function reasonForService({ directMatches, sharedMatches, runtimeDepMatches, buildSystemMatches, catalogReuse = null }) {
const reasons = [];
if (directMatches.some((item) => !isTestOnlyPath(item) && !isDocsOnlyPath(item))) reasons.push("component-path-changed");
if (sharedMatches.some((item) => !isTestOnlyPath(item) && !isDocsOnlyPath(item))) reasons.push("shared-runtime-changed");
if (runtimeDepMatches.some((item) => !isTestOnlyPath(item) && !isDocsOnlyPath(item))) reasons.push("runtime-deps-changed");
if (buildSystemMatches.some((item) => !isTestOnlyPath(item) && !isDocsOnlyPath(item))) reasons.push("build-system-changed");
if (catalogReuse?.status === "candidate-no-catalog") reasons.push("catalog-record-missing");
if (catalogReuse?.status === "candidate-unverified-digest") reasons.push("catalog-digest-missing");
return reasons.length ? reasons : ["affected"];
}