refactor: add node-scoped HWLAB lane CLI

This commit is contained in:
Codex
2026-06-08 14:18:58 +00:00
parent b3476b49f1
commit 8f51bbca91
8 changed files with 508 additions and 116 deletions
+20 -17
View File
@@ -1,5 +1,6 @@
import { activeV02PipelineRuns, g14ObservabilityQueryAssertion, gitMirrorFlushJobManifest, gitMirrorStatusSummary, gitMirrorSyncJobManifest, gitMirrorV02SyncRequirement, hwlabG14Help, hwlabG14MonitorStateFileName, parseGitMirrorStatusRefs, parseK8sCpuMillicores, parseK8sMemoryMiB, parsePipelineTaskRunMetrics, parseV02TriggerSnapshot, rolloutRecordBody, runtimeLanePipelineRunManifest, semanticChangelogBullets, summarizeV02CdStatus, v02CloseoutVerdict, v02CommitAlignment, v02ControlPlaneRefreshScriptHash, v02ControlPlaneRenderScript, v02ExistingPipelineRunReuseDecision, v02FalseGreenGuard, v02GitMirrorPreSyncWaitMs, v02LatestOnlyTargetValidation, v02PipelineServiceIds, v02PrAutomationCommentBody, v02ReusableGitMirrorPreSyncMarker, v02ReusableRefreshMarker, v02StatusHistoryPolicy, v02TaskRunPerformanceSummary } from "./src/hwlab-g14";
import { hwlabRequiredNoProxyEntries, hwlabRuntimeLaneConfigPath, hwlabRuntimeLaneIds, hwlabRuntimeLaneSpec } from "./src/hwlab-g14-lanes";
import { hwlabNodeHelp } from "./src/hwlab-node";
import { hwlabRequiredNoProxyEntries, hwlabRuntimeLaneConfigPath, hwlabRuntimeLaneIds, hwlabRuntimeLaneSpec } from "./src/hwlab-node-lanes";
import { runCommand } from "./src/command";
function assertCondition(condition: unknown, message: string, detail: unknown = {}): void {
@@ -36,6 +37,7 @@ assertCondition(
const hwlabHelp = hwlabG14Help();
const hwlabHelpUsage = Array.isArray(hwlabHelp.usage) ? hwlabHelp.usage.map((line: unknown) => String(line)) : [];
const hwlabHelpJson = JSON.stringify(hwlabHelp);
const hwlabNodeHelpJson = JSON.stringify(hwlabNodeHelp());
assertCondition(
hwlabHelpUsage.some((line) => line.includes("control-plane status --lane v02 --pipeline-run"))
&& hwlabHelpUsage.some((line) => line.includes("control-plane status --lane v02 --source-commit"))
@@ -48,17 +50,18 @@ assertCondition(
hwlabHelpUsage,
);
assertCondition(
hwlabHelpUsage.some((line) => line.includes("control-plane status --lane v03"))
&& hwlabHelpUsage.some((line) => line.includes("control-plane apply --lane v03 --dry-run"))
&& hwlabHelpUsage.some((line) => line.includes("control-plane trigger-current --lane v03 --dry-run"))
&& hwlabHelpJson.includes("runtime lane v02/v03"),
"v0.3 control-plane help must expose the runtime lane bootstrap status/apply/trigger entrypoints",
hwlabHelpUsage,
hwlabHelpUsage.some((line) => line.includes("hwlab nodes control-plane status --node G14 --lane v03"))
&& hwlabHelpUsage.some((line) => line.includes("hwlab nodes control-plane apply --node G14 --lane v03 --dry-run"))
&& hwlabHelpUsage.some((line) => line.includes("hwlab nodes control-plane trigger-current --node G14 --lane v03 --dry-run"))
&& hwlabNodeHelpJson.includes("hwlab nodes control-plane status --node G14 --lane v03")
&& hwlabHelpJson.includes("config/hwlab-node-lanes.yaml"),
"v0.3 control-plane help must expose node-scoped runtime lane bootstrap status/apply/trigger entrypoints",
{ hwlabHelpUsage, hwlabNodeHelp: hwlabNodeHelp() },
);
const v03LaneSpec = hwlabRuntimeLaneSpec("v03");
assertCondition(
JSON.stringify(hwlabRuntimeLaneIds()) === JSON.stringify(["v02", "v03"])
&& hwlabRuntimeLaneConfigPath() === "config/hwlab-g14-lanes.yaml"
&& hwlabRuntimeLaneConfigPath() === "config/hwlab-node-lanes.yaml"
&& v03LaneSpec.nodeId === "G14"
&& v03LaneSpec.nodeRoute === "G14"
&& v03LaneSpec.sourceBranch === "v0.3"
@@ -70,8 +73,8 @@ assertCondition(
&& v03LaneSpec.pipeline === "hwlab-v03-ci-image-publish"
&& v03LaneSpec.publicWebUrl.endsWith(":19766")
&& v03LaneSpec.publicApiUrl.endsWith(":19767")
&& v03LaneSpec.networkProfileId === "g14-ci-egress"
&& v03LaneSpec.downloadProfileId === "g14-default"
&& v03LaneSpec.networkProfileId === "node-ci-egress"
&& v03LaneSpec.downloadProfileId === "node-default"
&& v03LaneSpec.networkProfile.proxy.noProxy.includes("hyueapi.com")
&& v03LaneSpec.networkProfile.proxy.noProxy.includes(".hyueapi.com")
&& v03LaneSpec.networkProfile.dockerBuildProxy.noProxy.includes("hyueapi.com")
@@ -82,9 +85,9 @@ assertCondition(
v03LaneSpec,
);
assertCondition(
hwlabHelpJson.includes("config/hwlab-g14-lanes.yaml")
&& hwlabHelpJson.includes("g14-ci-egress")
&& hwlabHelpJson.includes("g14-default")
hwlabHelpJson.includes("config/hwlab-node-lanes.yaml")
&& hwlabHelpJson.includes("node-ci-egress")
&& hwlabHelpJson.includes("node-default")
&& hwlabHelpJson.includes("hyueapi.com"),
"G14 HWLAB help must expose the runtime lane YAML and required network/download profile identifiers",
hwlabHelp,
@@ -93,8 +96,8 @@ const v03PipelineRunManifest = runtimeLanePipelineRunManifest(v03LaneSpec, "aaaa
const v03PipelineRunAnnotations = record(record(v03PipelineRunManifest.metadata).annotations);
assertCondition(
v03PipelineRunAnnotations["hwlab.pikastech.local/node"] === "G14"
&& v03PipelineRunAnnotations["hwlab.pikastech.local/network-profile"] === "g14-ci-egress"
&& v03PipelineRunAnnotations["hwlab.pikastech.local/download-profile"] === "g14-default"
&& v03PipelineRunAnnotations["hwlab.pikastech.local/network-profile"] === "node-ci-egress"
&& v03PipelineRunAnnotations["hwlab.pikastech.local/download-profile"] === "node-default"
&& String(v03PipelineRunAnnotations["hwlab.pikastech.local/no-proxy-required"]).includes("hyueapi.com"),
"runtime lane PipelineRun manifest must preserve node/network/download profile provenance",
v03PipelineRunAnnotations,
@@ -109,8 +112,8 @@ assertCondition(
);
assertCondition(
hwlabHelpUsage.some((line) => line.includes("git-mirror apply --lane v02 --confirm"))
&& hwlabHelpUsage.some((line) => line.includes("git-mirror apply --lane v03 --confirm")),
"git mirror help must expose lane-selected apply so v0.3 mirror config is not rendered through v0.2",
&& hwlabHelpUsage.some((line) => line.includes("hwlab nodes git-mirror apply --node G14 --lane v03 --confirm")),
"git mirror help must expose node-scoped v0.3 apply so v0.3 mirror config is not rendered through v0.2",
hwlabHelpUsage,
);
assertCondition(