fix: allow control-plane apply source override

This commit is contained in:
Codex
2026-07-02 02:43:01 +00:00
parent 26c81ae1dc
commit 18b6b93390
+8 -4
View File
@@ -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<string>): Record<string, unknown>[] {
@@ -281,8 +281,12 @@ export function nodeRuntimeMigration(scoped: ReturnType<typeof parseNodeScopedDe
export function nodeRuntimeApply(scoped: ReturnType<typeof parseNodeScopedDelegatedOptions>): Record<string, unknown> {
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<typeof parseNodeScopedDelega
lane: scoped.lane,
phase: "source-head",
degradedReason: "node-runtime-source-head-unresolved",
headProbe: compactRuntimeCommand(head.result),
headProbe: head === null ? null : compactRuntimeCommand(head.result),
};
}
const localPostgres = syncNodeLocalPostgresBootstrapSecret(spec, scoped.dryRun, scoped.timeoutSeconds);