fix: restore cicd reuse catalog before planning

This commit is contained in:
root
2026-07-03 12:45:32 +00:00
parent b5bb1a86b4
commit 7e4ec0a225
4 changed files with 362 additions and 280 deletions
+17 -15
View File
@@ -165,29 +165,32 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
assert.match(pipeline, /tar -C \/workspace\/source\/repo -cf - \. \| tar -C \/workspace\/service-work\/repo -xo -f -/u);
assert.match(pipeline, /node scripts\/run-bun\.mjs test cmd\/hwlab-codex-api-responses-forwarder\/main\.test\.ts/u);
assert.doesNotMatch(pipeline, /cmd\/hwlab-codex-api-responses-forwarder\/main\.mjs/u);
assert.match(pipeline, /process\.exitCode = 1/u);
assert.match(pipeline, /item\.metadata\?\.labels\?\.\[\\"hwlab\.pikastech\.local\/source-commit\\"\]/u);
const runtimeReadySource = await readFile(path.join(process.cwd(), "scripts/ci/runtime-ready.mjs"), "utf8");
assert.match(runtimeReadySource, /process\.exitCode = 1/u);
assert.match(runtimeReadySource, /item\.metadata\?\.labels\?\.\["hwlab\.pikastech\.local\/source-commit"\]/u);
const runtimeReady = taskByName(pipelineJson, "runtime-ready");
assert.deepEqual(runtimeReady.when, [{ input: "$(tasks.gitops-promote.results.runtime-ready-required)", operator: "in", values: ["true"] }]);
const runtimeReadyScript = runtimeReady.taskSpec.steps[0].script;
assert.match(runtimeReadyScript, /const pollMs = 1000;/u);
assert.match(runtimeReadyScript, /readObservedServiceIds/u);
assert.match(runtimeReadyScript, /observedRuntimeItems/u);
assert.match(runtimeReadyScript, /observedCount/u);
assert.match(runtimeReadyScript, /readinessMode = observedServiceIds \? "service-rollout" : "infra-runtime-change"/u);
assert.match(runtimeReadyScript, /waitForArgoSyncedHealthy/u);
assert.match(runtimeReadyScript, /stage: "runtime-ready", status: "started"/u);
assert.match(runtimeReadyScript, /status: "progress"/u);
assert.match(runtimeReadyScript, /stage: "argo-sync-health"/u);
assert.match(runtimeReadyScript, /status: "timeout", reason: "source-commit-refresh-timeout"/u);
assert.match(runtimeReadyScript, /if \(!observedServiceIds\) \{/u);
assert.match(runtimeReadyScript, /const refresh = await waitForArgoRefresh\(\);\n if \(!refresh\.observed\) return;/u);
assert.match(runtimeReadyScript, /HWLAB_RUNTIME_READY_TIMEOUT_MS="\$\(params\.timeout-ms\)"/u);
assert.match(runtimeReadyScript, /cd \/workspace\/source\/repo/u);
assert.match(runtimeReadyScript, /node scripts\/ci\/runtime-ready\.mjs/u);
assert.ok(runtimeReady.taskSpec.params.some((param) => param.name === "argo-application"));
assert.ok(runtimeReady.taskSpec.params.some((param) => param.name === "timeout-ms"));
assert.ok(runtimeReady.params.some((param) => param.name === "argo-application" && param.value === "hwlab-node-v02"));
assert.ok(runtimeReady.params.some((param) => param.name === "timeout-ms" && param.value === "$(params.runtime-ready-timeout-ms)"));
assert.ok(runtimeReady.workspaces?.some((workspace) => workspace.name === "source" && workspace.workspace === "source"));
assert.ok(runtimeReady.taskSpec.workspaces?.some((workspace) => workspace.name === "source"));
const planArtifacts = taskByName(pipelineJson, "plan-artifacts");
const planArtifactsScript = planArtifacts.taskSpec.steps[0].script;
assert.match(planArtifactsScript, /node scripts\/ci\/restore-artifact-catalog\.mjs/u);
assert.match(planArtifactsScript, /HWLAB_GIT_READ_URL="\$\(params\.git-read-url\)"/u);
assert.ok(planArtifacts.taskSpec.params.some((param) => param.name === "git-read-url"));
assert.ok(planArtifacts.taskSpec.params.some((param) => param.name === "gitops-branch"));
assert.ok(planArtifacts.params.some((param) => param.name === "lane" && param.value === "$(params.lane)"));
assert.ok(pipelineJson.spec.params.some((param) => param.name === "runtime-ready-timeout-ms" && param.default === "60000"));
const gitopsPromote = taskByName(pipelineJson, "gitops-promote");
assert.ok(gitopsPromote.taskSpec.results.some((result) => result.name === "runtime-ready-required"));
const gitopsPromoteScript = gitopsPromote.taskSpec.steps[0].script;
@@ -238,7 +241,6 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
assert.doesNotMatch(prepareSourceScript, /prepare-source-proxy-preflight/u);
assert.doesNotMatch(prepareSourceScript, /dependency-curl-probe-start/u);
const planArtifacts = taskByName(pipelineJson, "plan-artifacts");
assert.doesNotMatch(planArtifacts.taskSpec.steps[0].script, /plan-artifacts-proxy-preflight/u);
const collectArtifacts = taskByName(pipelineJson, "collect-artifacts");
assert.doesNotMatch(collectArtifacts.taskSpec.steps[0].script, /collect-artifacts-proxy-preflight/u);