diff --git a/scripts/gitops-render.mjs b/scripts/gitops-render.mjs index 25e3e89d..2a5777f5 100644 --- a/scripts/gitops-render.mjs +++ b/scripts/gitops-render.mjs @@ -3280,6 +3280,12 @@ function imagePublishTaskSet(args = { lane: "node" }, deploy = null) { function tektonPipeline(args = { lane: "node" }, deploy = null) { const settings = ciLaneSettings(args); const runtimePath = gitopsPathForProfile(args, settings.profile); + const preFlushRuntimeReadyTasks = isRuntimeLane(settings.lane) + ? [] + : [{ + ...runtimeReadyTask({ profile: settings.profile }), + when: [{ input: "$(tasks.gitops-promote.results.runtime-ready-required)", operator: "in", values: ["true"] }] + }]; return { apiVersion: "tekton.dev/v1", kind: "Pipeline", @@ -3395,10 +3401,7 @@ function tektonPipeline(args = { lane: "node" }, deploy = null) { { name: "registry-prefix", value: "$(params.registry-prefix)" } ] }, - { - ...runtimeReadyTask({ profile: settings.profile }), - when: [{ input: "$(tasks.gitops-promote.results.runtime-ready-required)", operator: "in", values: ["true"] }] - } + ...preFlushRuntimeReadyTasks ] } }; diff --git a/scripts/gitops-render.test.ts b/scripts/gitops-render.test.ts index 6dd9800f..ea1c3754 100644 --- a/scripts/gitops-render.test.ts +++ b/scripts/gitops-render.test.ts @@ -169,18 +169,7 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots 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, /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")); + assert.ok(!pipelineJson.spec.tasks.some((task) => task.name === "runtime-ready")); const planArtifacts = taskByName(pipelineJson, "plan-artifacts"); const planArtifactsScript = planArtifacts.taskSpec.steps[0].script; @@ -611,6 +600,7 @@ test("v03 render keeps node identity as data instead of generated structure", as const pipelineJson = JSON.parse(pipeline); assert.match(pipeline, /--external-service-report-dir \/workspace\/source\/service-results/u); assert.match(pipeline, /--ci-plan-path \/workspace\/source\/affected-services\.json/u); + assert.ok(!pipelineJson.spec.tasks.some((task) => task.name === "runtime-ready")); const gitopsPromote = taskByName(pipelineJson, "gitops-promote"); const gitopsPromoteScript = gitopsPromote.taskSpec.steps[0].script; assert.match(gitopsPromoteScript, /if \[ "\$runtime_lane" = "true" \]; then\s+printf 'false' > \/tekton\/results\/runtime-ready-required\s+else\s+printf 'true' > \/tekton\/results\/runtime-ready-required/u);