fix: 修正 runtime GitOps verify marker 组合判定
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -392,7 +392,7 @@ function extractPacSourceObservation(recordsInput) {
|
|||||||
const skipMarkerSeen = collectMarker !== null || promoteMarker !== null;
|
const skipMarkerSeen = collectMarker !== null || promoteMarker !== null;
|
||||||
const skipMarkerConflict = skipMarkerSeen && !noRuntimeChangePlan;
|
const skipMarkerConflict = skipMarkerSeen && !noRuntimeChangePlan;
|
||||||
const runtimeGitopsVerifyMarkerConflict = runtimeGitopsVerifyMarker !== null
|
const runtimeGitopsVerifyMarkerConflict = runtimeGitopsVerifyMarker !== null
|
||||||
&& (!noRuntimeChangePlan || skipMarkerSeen);
|
&& (!noRuntimeChangePlan || promoteMarker !== null);
|
||||||
const deliveryTerminalReady = planTask?.status === "succeeded"
|
const deliveryTerminalReady = planTask?.status === "succeeded"
|
||||||
&& collectTask?.status === "succeeded"
|
&& collectTask?.status === "succeeded"
|
||||||
&& promoteTask?.status === "succeeded";
|
&& promoteTask?.status === "succeeded";
|
||||||
@@ -411,7 +411,7 @@ function extractPacSourceObservation(recordsInput) {
|
|||||||
mode = "runtime-gitops-verify";
|
mode = "runtime-gitops-verify";
|
||||||
valid = true;
|
valid = true;
|
||||||
reason = "no-build-no-rollout-plan-gitops-verify";
|
reason = "no-build-no-rollout-plan-gitops-verify";
|
||||||
} else if (planShapeValid && sourceCommitValid && !noRuntimeChangePlan && !skipMarkerConflict && deliveryTerminalReady) {
|
} else if (planShapeValid && sourceCommitValid && !noRuntimeChangePlan && runtimeGitopsVerifyMarker === null && !skipMarkerConflict && deliveryTerminalReady) {
|
||||||
mode = "delivery";
|
mode = "delivery";
|
||||||
valid = true;
|
valid = true;
|
||||||
reason = "artifact-or-runtime-delivery-required";
|
reason = "artifact-or-runtime-delivery-required";
|
||||||
@@ -922,6 +922,7 @@ function runtimeGitopsVerifyObservation(sourceCommit = "c".repeat(40)) {
|
|||||||
reusedServices: Array.from({ length: 8 }, (_item, index) => `service-${index}`),
|
reusedServices: Array.from({ length: 8 }, (_item, index) => `service-${index}`),
|
||||||
noImageBuildReason: "test-only-change",
|
noImageBuildReason: "test-only-change",
|
||||||
},
|
},
|
||||||
|
{ event: "collect-artifacts", status: "skipped", reason: "no-build-no-rollout-plan" },
|
||||||
{ event: "gitops-promote", status: "continuing", reason: "no-build-no-rollout-plan-gitops-verify" },
|
{ event: "gitops-promote", status: "continuing", reason: "no-build-no-rollout-plan-gitops-verify" },
|
||||||
{ event: "pac-task-terminal", pipelineTask: "plan-artifacts", taskRun: "plan", status: "succeeded", reason: "Succeeded", results: [] },
|
{ event: "pac-task-terminal", pipelineTask: "plan-artifacts", taskRun: "plan", status: "succeeded", reason: "Succeeded", results: [] },
|
||||||
{ event: "pac-task-terminal", pipelineTask: "collect-artifacts", taskRun: "collect", status: "succeeded", reason: "Succeeded", results: [] },
|
{ event: "pac-task-terminal", pipelineTask: "collect-artifacts", taskRun: "collect", status: "succeeded", reason: "Succeeded", results: [] },
|
||||||
@@ -1068,7 +1069,7 @@ function runPacStatusFixtureChecks() {
|
|||||||
]) } }),
|
]) } }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "runtime-gitops-verify-marker-conflict",
|
id: "runtime-gitops-verify-promote-marker-conflict",
|
||||||
expectedOk: false,
|
expectedOk: false,
|
||||||
expectedCode: "pac-source-observation-inconsistent",
|
expectedCode: "pac-source-observation-inconsistent",
|
||||||
input: fixtureInput({ artifact: { sourceObservation: extractPacSourceObservation([
|
input: fixtureInput({ artifact: { sourceObservation: extractPacSourceObservation([
|
||||||
@@ -1081,6 +1082,30 @@ function runPacStatusFixtureChecks() {
|
|||||||
{ event: "pac-task-terminal", pipelineTask: "gitops-promote", taskRun: "promote", status: "succeeded", reason: "Succeeded", results: [] },
|
{ event: "pac-task-terminal", pipelineTask: "gitops-promote", taskRun: "promote", status: "succeeded", reason: "Succeeded", results: [] },
|
||||||
]) } }),
|
]) } }),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "runtime-gitops-verify-nonzero-plan-conflict",
|
||||||
|
expectedOk: false,
|
||||||
|
expectedCode: "pac-source-observation-inconsistent",
|
||||||
|
input: fixtureInput({ artifact: { sourceObservation: extractPacSourceObservation([
|
||||||
|
{ event: "g14-ci-plan", sourceCommitId: "c".repeat(40), affectedServices: ["service"], rolloutServices: ["service"], buildServices: [], reusedServices: ["service"] },
|
||||||
|
{ event: "gitops-promote", status: "continuing", reason: "no-build-no-rollout-plan-gitops-verify" },
|
||||||
|
{ event: "pac-task-terminal", pipelineTask: "plan-artifacts", taskRun: "plan", status: "succeeded", reason: "Succeeded", results: [] },
|
||||||
|
{ event: "pac-task-terminal", pipelineTask: "collect-artifacts", taskRun: "collect", status: "succeeded", reason: "Succeeded", results: [] },
|
||||||
|
{ event: "pac-task-terminal", pipelineTask: "gitops-promote", taskRun: "promote", status: "succeeded", reason: "Succeeded", results: [] },
|
||||||
|
]) } }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "runtime-gitops-verify-terminal-evidence-missing",
|
||||||
|
expectedOk: false,
|
||||||
|
expectedCode: "pac-source-observation-inconsistent",
|
||||||
|
input: fixtureInput({ artifact: { sourceObservation: extractPacSourceObservation([
|
||||||
|
{ event: "g14-ci-plan", sourceCommitId: "c".repeat(40), affectedServices: [], rolloutServices: [], buildServices: [], reusedServices: ["service"] },
|
||||||
|
{ event: "collect-artifacts", status: "skipped", reason: "no-build-no-rollout-plan" },
|
||||||
|
{ event: "gitops-promote", status: "continuing", reason: "no-build-no-rollout-plan-gitops-verify" },
|
||||||
|
{ event: "pac-task-terminal", pipelineTask: "plan-artifacts", taskRun: "plan", status: "succeeded", reason: "Succeeded", results: [] },
|
||||||
|
{ event: "pac-task-terminal", pipelineTask: "collect-artifacts", taskRun: "collect", status: "succeeded", reason: "Succeeded", results: [] },
|
||||||
|
]) } }),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "retained-source-mismatch",
|
id: "retained-source-mismatch",
|
||||||
expectedOk: false,
|
expectedOk: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user