Merge pull request #1644 from pikasTech/fix/1643-agentrun-pac-route
修复 AgentRun migrated lane 的 PaC 状态路由
This commit is contained in:
@@ -347,13 +347,19 @@ export async function status(config: UniDeskConfig, options: StatusOptions): Pro
|
||||
}
|
||||
|
||||
function isPipelinesAsCodeMigratedLane(spec: AgentRunLaneSpec): boolean {
|
||||
return spec.gitMirror.readUrl.includes("gitea-http.")
|
||||
return spec.source.remote.includes("gitea-http.")
|
||||
|| spec.source.remote.includes("/mirrors/")
|
||||
|| spec.gitMirror.readUrl.includes("gitea-http.")
|
||||
|| spec.gitops.repoURL.includes("gitea-http.")
|
||||
|| spec.gitMirror.readUrl.includes("/mirrors/");
|
||||
}
|
||||
|
||||
function pacStatusCommand(spec: AgentRunLaneSpec, full = false): string {
|
||||
return `bun scripts/cli.ts platform-infra pipelines-as-code status --target ${spec.nodeId}${full ? " --full" : ""}`;
|
||||
return `bun scripts/cli.ts platform-infra pipelines-as-code status --target ${spec.nodeId} --consumer ${pacConsumerId(spec)}${full ? " --full" : ""}`;
|
||||
}
|
||||
|
||||
function pacConsumerId(spec: AgentRunLaneSpec): string {
|
||||
return `agentrun-${spec.lane.toLowerCase()}`;
|
||||
}
|
||||
|
||||
function giteaMirrorStatusCommand(spec: AgentRunLaneSpec): string {
|
||||
@@ -362,7 +368,7 @@ function giteaMirrorStatusCommand(spec: AgentRunLaneSpec): string {
|
||||
|
||||
export async function statusPipelinesAsCodeLane(config: UniDeskConfig, options: StatusOptions, target: { configPath: string; spec: AgentRunLaneSpec }): Promise<Record<string, unknown>> {
|
||||
const spec = target.spec;
|
||||
const pacStatus = record(await runPlatformInfraPipelinesAsCodeCommand(config, ["status", "--target", spec.nodeId, "--full"]));
|
||||
const pacStatus = record(await runPlatformInfraPipelinesAsCodeCommand(config, ["status", "--target", spec.nodeId, "--consumer", pacConsumerId(spec), "--full"]));
|
||||
const pacSummary = record(pacStatus.summary);
|
||||
const latestPipelineRun = record(pacSummary.latestPipelineRun);
|
||||
const artifact = record(pacSummary.artifact);
|
||||
|
||||
Reference in New Issue
Block a user