From 18b6b9339080ffa40043c4b8e1e3f6ff8787ca91 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 2 Jul 2026 02:43:01 +0000 Subject: [PATCH] fix: allow control-plane apply source override --- scripts/src/hwlab-node/control-actions.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/src/hwlab-node/control-actions.ts b/scripts/src/hwlab-node/control-actions.ts index fcc446ec..78d0a9b0 100644 --- a/scripts/src/hwlab-node/control-actions.ts +++ b/scripts/src/hwlab-node/control-actions.ts @@ -33,7 +33,7 @@ import { HWLAB_CI_NAMESPACE } from "./entry"; import { nodeRuntimeExpected, parseNodeScopedDelegatedOptions } from "./plan"; import { renderNodeRuntimeControlPlane } from "./render"; import { compactRuntimeCommand, sshTcpPoolDiagnosticsFromCommand } from "./runtime-common"; -import { commaListField, keyValueLinesFromText, numericField, shellQuote, statusText } from "./utils"; +import { commaListField, keyValueLinesFromText, numericField, optionValue, shellQuote, statusText } from "./utils"; import { applyLocalNodeRuntimeControlPlaneFiles, applyNodeRuntimeControlPlaneFiles, cleanupLocalNodeRuntimeRenderDir, cleanupNodeRuntimeRenderDir, ensureNodeBaseImage, nodeRuntimeBaseImageStatus, syncNodeExternalPostgresSecrets, syncNodeLocalPostgresBootstrapSecret } from "./web-probe"; export function nodeRuntimeCleanupOwnedTaskRunsFromText(text: string, wanted: Set): Record[] { @@ -281,8 +281,12 @@ export function nodeRuntimeMigration(scoped: ReturnType): Record { const spec = scoped.spec; - const head = resolveNodeRuntimeLaneHead(spec); - const sourceCommit = head.sourceCommit; + const sourceCommitOverride = optionValue(scoped.originalArgs, "--source-commit")?.toLowerCase(); + if (sourceCommitOverride !== undefined && !/^[0-9a-f]{40}$/u.test(sourceCommitOverride)) { + throw new Error("--source-commit must be a full 40-character git sha for control-plane apply"); + } + const head = sourceCommitOverride === undefined ? resolveNodeRuntimeLaneHead(spec) : null; + const sourceCommit = sourceCommitOverride ?? head?.sourceCommit ?? null; if (sourceCommit === null) { return { ok: false, @@ -291,7 +295,7 @@ export function nodeRuntimeApply(scoped: ReturnType