Merge pull request #2698 from pikasTech/fix/2697-tools-image-status-summary
压缩 tools-image 状态输出
This commit is contained in:
@@ -901,6 +901,8 @@ function toolsImageCommandStatus(node: ControlPlaneNodeSpec, target: ControlPlan
|
||||
const registry = toolsImageStatus(node, target, options.timeoutSeconds);
|
||||
const jobResult = runTransK3s(node.kubeRoute, remoteJobStatusScript(target, "tools-image", options.tailLines), options.timeoutSeconds);
|
||||
const jobStatus = parseRemoteJson(jobResult.stdout);
|
||||
const job = record(jobStatus);
|
||||
const status = record(job.status);
|
||||
const ok = registry.registryReady && registry.toolsImageReady;
|
||||
return {
|
||||
ok,
|
||||
@@ -910,10 +912,34 @@ function toolsImageCommandStatus(node: ControlPlaneNodeSpec, target: ControlPlan
|
||||
lane: target.lane,
|
||||
mutation: false,
|
||||
image: target.tekton.toolsImage.output,
|
||||
imageSource: target.tekton.toolsImage,
|
||||
registry,
|
||||
job: typeof jobStatus === "object" && jobStatus !== null ? jobStatus : { parseError: "remote job status did not return JSON", stdoutPreview: jobResult.stdout.slice(0, 1000) },
|
||||
result: compactCommandResult(jobResult),
|
||||
imageSource: {
|
||||
configPath: `${HWLAB_NODE_CONTROL_PLANE_CONFIG_PATH}#targets.${target.id}.tekton.toolsImage`,
|
||||
sourceKind: target.tekton.toolsImage.sourceKind,
|
||||
dockerfile: target.tekton.toolsImage.dockerfileInline?.filename ?? null,
|
||||
buildOwner: target.tekton.toolsImage.buildOwner,
|
||||
buildMode: target.tekton.toolsImage.buildMode,
|
||||
},
|
||||
registry: {
|
||||
ready: registry.registryReady,
|
||||
toolsImageReady: registry.toolsImageReady,
|
||||
},
|
||||
job: typeof jobStatus === "object" && jobStatus !== null ? {
|
||||
stateDir: job.stateDir ?? null,
|
||||
pid: job.pid ?? null,
|
||||
running: job.running === true,
|
||||
state: status.state ?? null,
|
||||
message: status.message ?? null,
|
||||
imageId: status.imageId ?? null,
|
||||
repoDigests: Array.isArray(status.repoDigests) ? status.repoDigests : [],
|
||||
updatedAt: status.updatedAt ?? null,
|
||||
logBytes: job.logBytes ?? null,
|
||||
} : { parseError: "remote job status did not return JSON" },
|
||||
transport: {
|
||||
exitCode: jobResult.exitCode,
|
||||
timedOut: jobResult.timedOut,
|
||||
stdoutBytes: jobResult.stdoutBytes,
|
||||
stderrBytes: jobResult.stderrBytes,
|
||||
},
|
||||
next: ok
|
||||
? { infraStatus: `bun scripts/cli.ts hwlab nodes control-plane infra status --node ${node.id} --lane ${target.lane}` }
|
||||
: { build: `bun scripts/cli.ts hwlab nodes control-plane infra tools-image build --node ${node.id} --lane ${target.lane} --confirm`, logs: `bun scripts/cli.ts hwlab nodes control-plane infra tools-image logs --node ${node.id} --lane ${target.lane}` },
|
||||
|
||||
Reference in New Issue
Block a user