diff --git a/scripts/src/agentrun/control-plane.ts b/scripts/src/agentrun/control-plane.ts index 1bdb0b1a..8a829762 100644 --- a/scripts/src/agentrun/control-plane.ts +++ b/scripts/src/agentrun/control-plane.ts @@ -80,9 +80,20 @@ export function parseLaneConfirmOptions(args: string[]): LaneConfirmOptions { const base = parseConfirmOptions(args); let node: string | null = null; let lane: string | null = null; + let full = false; + let raw = false; for (let index = 0; index < args.length; index += 1) { const arg = args[index]; if (arg === "--confirm" || arg === "--dry-run") continue; + if (arg === "--full") { + full = true; + continue; + } + if (arg === "--raw") { + raw = true; + full = true; + continue; + } if (arg === "--node") { const value = args[index + 1]; if (value === undefined || value.startsWith("--")) throw new Error("--node requires a value"); @@ -100,7 +111,7 @@ export function parseLaneConfirmOptions(args: string[]): LaneConfirmOptions { throw new Error(`unsupported control-plane option: ${arg}`); } if (node === null && lane === null) throw new Error("control-plane apply requires --node and --lane"); - return { ...base, node, lane }; + return { ...base, node, lane, full, raw }; } export function parseRefreshOptions(args: string[]): RefreshOptions { diff --git a/scripts/src/agentrun/entry.ts b/scripts/src/agentrun/entry.ts index 3d8bed88..4146fef7 100644 --- a/scripts/src/agentrun/entry.ts +++ b/scripts/src/agentrun/entry.ts @@ -128,7 +128,11 @@ export async function runAgentRunCommand(config: UniDeskConfig | null, args: str return options.full || options.raw ? result : renderAgentRunControlPlaneStatusSummary(result); } if (action === "secret-sync") return await secretSync(config, parseSecretSyncOptions(actionArgs)); - if (action === "restart") return await restartYamlLane(config, parseLaneConfirmOptions(actionArgs)); + if (action === "restart") { + const options = parseLaneConfirmOptions(actionArgs); + const result = await restartYamlLane(config, options); + return options.full || options.raw ? result : renderAgentRunControlPlaneActionSummary(result, "AGENTRUN CONTROL-PLANE RESTART"); + } if (action === "expose") return await exposeAgentRun(config, parseConfirmOptions(actionArgs)); if (action === "trigger-current") { const options = parseTriggerOptions(actionArgs); diff --git a/scripts/src/agentrun/options.ts b/scripts/src/agentrun/options.ts index c67400a9..1f9f26c5 100644 --- a/scripts/src/agentrun/options.ts +++ b/scripts/src/agentrun/options.ts @@ -222,7 +222,7 @@ export interface SecretSyncOptions extends ConfirmOptions { secretIds: string[]; } -export interface LaneConfirmOptions extends ConfirmOptions { +export interface LaneConfirmOptions extends ConfirmOptions, DisclosureOptions { node: string | null; lane: string | null; } diff --git a/scripts/src/agentrun/public-exposure.ts b/scripts/src/agentrun/public-exposure.ts index 07058e62..ab8072b6 100644 --- a/scripts/src/agentrun/public-exposure.ts +++ b/scripts/src/agentrun/public-exposure.ts @@ -218,6 +218,17 @@ export function renderAgentRunControlPlaneActionSummary(result: Record row[1] !== "-"); const countKeys = [ "runnerJobCount", "inactiveCandidateCount", @@ -246,6 +257,20 @@ export function renderAgentRunControlPlaneActionSummary(result: Record 0) lines.push("", "PLAN", renderTable(["FIELD", "VALUE"], planRows)); + if (providerCredentials.length > 0) { + lines.push( + "", + "PROVIDER CREDENTIALS", + renderTable(["PROFILE", "NAMESPACE", "SECRET", "KEYS", "VALUES"], providerCredentials.slice(0, 8).map((credential) => [ + displayValue(credential.profile), + displayValue(credential.namespace), + displayValue(credential.name), + Array.isArray(credential.keys) ? credential.keys.map(String).join(",") : "-", + "false", + ])), + ); + } if (countRows.length > 0) lines.push("", renderTable(["COUNT", "VALUE"], countRows)); const nextLines = renderNextObjectLines(record(result.next ?? result.followUp)); if (nextLines.length > 0) lines.push("", "NEXT", ...nextLines); diff --git a/scripts/src/agentrun/trigger.ts b/scripts/src/agentrun/trigger.ts index 0504122d..96618881 100644 --- a/scripts/src/agentrun/trigger.ts +++ b/scripts/src/agentrun/trigger.ts @@ -131,6 +131,7 @@ export function compactAgentRunLaneStatusTarget(spec: AgentRunLaneSpec): Record< export async function restartYamlLane(config: UniDeskConfig, options: LaneConfirmOptions): Promise> { const { configPath, spec } = resolveAgentRunLaneTarget(options); + const target = options.full || options.raw ? agentRunLaneSummary(spec) : compactAgentRunLaneStatusTarget(spec); const plan = { node: spec.nodeId, kubeRoute: spec.nodeKubeRoute, @@ -139,6 +140,26 @@ export async function restartYamlLane(config: UniDeskConfig, options: LaneConfir deployment: spec.runtime.managerDeployment, annotation: "kubectl.kubernetes.io/restartedAt", reason: "reload-lane-secrets-or-runtime-env", + patchType: "deployment-template-annotation", + secretRefs: { + count: spec.secrets.length, + items: spec.secrets.map((secret) => ({ + id: secret.id, + namespace: secret.targetRef.namespace, + name: secret.targetRef.name, + key: secret.targetRef.key, + providerCredentialProfile: secret.providerCredentialProfile, + valuesPrinted: false, + })), + valuesPrinted: false, + }, + providerCredentials: agentRunProviderCredentialRefs(spec).map((credential) => ({ + profile: credential.profile, + namespace: credential.secretRef.namespace, + name: credential.secretRef.name, + keys: credential.secretRef.keys, + valuesPrinted: false, + })), valuesPrinted: false, }; if (options.dryRun || !options.confirm) { @@ -148,11 +169,12 @@ export async function restartYamlLane(config: UniDeskConfig, options: LaneConfir mode: "dry-run", mutation: false, configPath, - target: agentRunLaneSummary(spec), + target, plan, next: { confirm: `bun scripts/cli.ts agentrun control-plane restart --node ${spec.nodeId} --lane ${spec.lane} --confirm`, status: `bun scripts/cli.ts agentrun control-plane status --node ${spec.nodeId} --lane ${spec.lane}`, + full: `bun scripts/cli.ts agentrun control-plane restart --node ${spec.nodeId} --lane ${spec.lane} --dry-run --full`, }, valuesPrinted: false, }; @@ -165,12 +187,13 @@ export async function restartYamlLane(config: UniDeskConfig, options: LaneConfir mode: "confirmed-rollout-restart", mutation: true, configPath, - target: agentRunLaneSummary(spec), + target, plan, result: payload, capture: compactCapture(result, { full: result.exitCode !== 0, stdoutTailChars: 4000, stderrTailChars: 4000 }), next: { status: `bun scripts/cli.ts agentrun control-plane status --node ${spec.nodeId} --lane ${spec.lane}`, + full: `bun scripts/cli.ts agentrun control-plane restart --node ${spec.nodeId} --lane ${spec.lane} --dry-run --full`, }, valuesPrinted: false, };