fix: clean legacy runtime lane argo apps

This commit is contained in:
Codex
2026-06-08 16:09:06 +00:00
parent 1c5f88464d
commit aadbf176ba
3 changed files with 30 additions and 4 deletions
+5 -1
View File
@@ -383,10 +383,14 @@ assertCondition(
assertCondition(
sourceText.includes("function runG14K3sRemoteAsync")
&& sourceText.includes("function applyRuntimeLaneControlPlaneFiles")
&& sourceText.includes("function legacyRuntimeLaneArgoApplications")
&& sourceText.includes("hwlab-g14-${spec.lane}")
&& sourceText.includes('"delete",')
&& sourceText.includes('"application",')
&& sourceText.includes("label: `${spec.lane}-control-plane-apply`")
&& sourceText.includes("remote async command timed out after")
&& sourceText.includes("return runG14K3sRemoteAsync({"),
"runtime lane control-plane apply must use short start/poll remote-async semantics instead of one long G14:k3s apply call",
"runtime lane control-plane apply must use short start/poll remote-async semantics and clean legacy lane applications through the controlled entry",
);
const existingPipelineRunReuse = v02ExistingPipelineRunReuseDecision({
sourceCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+24 -2
View File
@@ -3005,6 +3005,11 @@ function cleanupV02RenderDir(renderDir: string): CommandJsonResult {
return cleanupRuntimeLaneRenderDir(V02_LANE_SPEC, renderDir);
}
function legacyRuntimeLaneArgoApplications(spec: HwlabRuntimeLaneSpec): string[] {
if (spec.lane === "v02") return [];
return [`hwlab-g14-${spec.lane}`].filter((name) => name !== spec.app);
}
function applyRuntimeLaneControlPlaneFiles(spec: HwlabRuntimeLaneSpec, renderDir: string, dryRun: boolean, timeoutSeconds: number): CommandJsonResult {
const namespaceFile = `${renderDir}/${spec.runtimeRenderDir}/namespace.yaml`;
const rbacFile = `${renderDir}/${spec.tektonDir}/rbac.yaml`;
@@ -3012,6 +3017,7 @@ function applyRuntimeLaneControlPlaneFiles(spec: HwlabRuntimeLaneSpec, renderDir
const projectFile = `${renderDir}/argocd/project.yaml`;
const applicationFile = `${renderDir}/argocd/${spec.argoApplicationFile}`;
const resourceFiles = [namespaceFile, rbacFile, pipelineFile, projectFile, applicationFile];
const legacyApplications = legacyRuntimeLaneArgoApplications(spec);
const serverSideArgs = [
"kubectl",
"apply",
@@ -3044,12 +3050,28 @@ function applyRuntimeLaneControlPlaneFiles(spec: HwlabRuntimeLaneSpec, renderDir
].map(shellQuote).join(" "),
].join("\n")
: `exec ${serverSideArgs.map(shellQuote).join(" ")}`;
const cleanupCommands = legacyApplications.map((name) => [
"kubectl",
"delete",
"application",
"-n",
"argocd",
name,
"--ignore-not-found=true",
...(dryRun ? ["--dry-run=server", "-o", "name"] : []),
].map(shellQuote).join(" "));
const script = cleanupCommands.length > 0
? ["set -eu", shellCommand.replace(/^exec /, ""), ...cleanupCommands].join("\n")
: shellCommand;
const visibleCommand = cleanupCommands.length > 0
? ["bun", "scripts/cli.ts", "ssh", `${G14_PROVIDER}:k3s`, "script", "--", script]
: command;
return runG14K3sRemoteAsync({
script: shellCommand,
script,
timeoutSeconds,
label: `${spec.lane}-control-plane-apply`,
token: runtimeLaneRenderToken(),
command,
command: visibleCommand,
});
}