fix: unify node git mirror apply path

This commit is contained in:
Codex
2026-07-03 15:51:04 +00:00
parent e20739a0f2
commit e973b73dbc
5 changed files with 54 additions and 1 deletions
+20
View File
@@ -2039,6 +2039,7 @@ function compactNativePayload(payload: Record<string, unknown> | null): Record<s
if (payload === null) return null;
return {
source: compactSourcePayload(asOptionalRecord(payload.source)),
sourceSync: compactSourceSyncPayload(asOptionalRecord(payload.sourceSync)),
gitMirror: asOptionalRecord(payload.gitMirror),
tekton: asOptionalRecord(payload.tekton),
taskRuns: compactTaskRunsPayload(asOptionalRecord(payload.taskRuns)),
@@ -2051,6 +2052,25 @@ function compactNativePayload(payload: Record<string, unknown> | null): Record<s
};
}
function compactSourceSyncPayload(value: Record<string, unknown> | null): Record<string, unknown> | null {
if (value === null) return null;
return {
ok: value.ok === true,
completed: value.completed === true,
failed: value.failed === true,
timedOut: value.timedOut === true,
created: value.created === true,
reused: value.reused === true,
jobName: stringOrNull(value.jobName),
namespace: stringOrNull(value.namespace),
elapsedMs: numberOrNull(value.elapsedMs),
conditionReason: stringOrNull(value.conditionReason),
conditionMessage: stringOrNull(value.conditionMessage),
statusAuthority: stringOrNull(value.statusAuthority),
parsedDownstreamCliOutput: false,
};
}
function compactTaskRunsPayload(taskRuns: Record<string, unknown> | null): Record<string, unknown> | null {
if (taskRuns === null) return null;
return {
+29
View File
@@ -343,6 +343,29 @@ export function nodeRuntimeApply(scoped: ReturnType<typeof parseNodeScopedDelega
degradedReason: "node-runtime-base-image-seed-failed",
};
}
const infra = runHwlabNodeControlPlaneInfra([
"apply",
"--node", scoped.node,
"--lane", scoped.lane,
scoped.dryRun ? "--dry-run" : "--confirm",
"--timeout-seconds", String(scoped.timeoutSeconds),
]);
if (!infraResultOk(infra)) {
return {
ok: false,
command: `hwlab nodes control-plane apply --node ${scoped.node} --lane ${scoped.lane}`,
node: scoped.node,
lane: scoped.lane,
mode: scoped.dryRun ? "dry-run" : "confirmed-apply",
phase: "control-plane-infra-apply",
sourceCommit,
localPostgres,
secrets,
baseImage,
infra,
degradedReason: "node-runtime-control-plane-infra-apply-failed",
};
}
const render = renderNodeRuntimeControlPlane(spec, sourceCommit, scoped.timeoutSeconds);
if (!isCommandSuccess(render.result)) {
return {
@@ -356,6 +379,7 @@ export function nodeRuntimeApply(scoped: ReturnType<typeof parseNodeScopedDelega
localPostgres,
secrets,
baseImage,
infra,
renderDir: render.renderDir,
renderLocation: render.location,
render: compactRuntimeCommand(render.result),
@@ -381,6 +405,7 @@ export function nodeRuntimeApply(scoped: ReturnType<typeof parseNodeScopedDelega
localPostgres,
secrets,
baseImage,
infra,
renderDir: render.renderDir,
renderLocation: render.location,
render: compactRuntimeCommand(render.result),
@@ -397,6 +422,10 @@ export function nodeRuntimeApply(scoped: ReturnType<typeof parseNodeScopedDelega
};
}
function infraResultOk(value: Record<string, unknown> | RenderedCliResult): boolean {
return value.ok !== false;
}
export function nodeRuntimeRefresh(scoped: ReturnType<typeof parseNodeScopedDelegatedOptions>): Record<string, unknown> {
const spec = scoped.spec;
const script = [
-1
View File
@@ -176,7 +176,6 @@ export function httpProxyEndpoint(value: string): { host: string; port: number }
export function nodeRuntimeControlPlaneFiles(spec: HwlabRuntimeLaneSpec, renderDir: string): string[] {
return [
`${renderDir}/devops-infra/git-mirror.yaml`,
`${renderDir}/${spec.runtimeRenderDir}/namespace.yaml`,
`${renderDir}/${spec.tektonDir}/rbac.yaml`,
`${renderDir}/${spec.tektonDir}/pipeline.yaml`,