fix: YAML-first 治理 CI/CD target (#919)
* docs: specify cicd yaml target governance * fix: resolve cicd targets from yaml --------- Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
+20
-4
@@ -1,4 +1,5 @@
|
||||
// SPEC: PJ2026-01060307 控制面模块化 draft-2026-06-25-p0. entry module for scripts/src/ci.ts.
|
||||
// SPEC: PJ2026-01060308 cicd-yaml-targets draft-2026-06-25-cicd-yaml-targets.
|
||||
|
||||
// Moved mechanically from scripts/src/ci.ts:3410-3600 for #903.
|
||||
|
||||
@@ -29,7 +30,7 @@ import { logs } from "./logs";
|
||||
import { blockedArtifactResult, blockedReason, boolFlag, ciCleanupFailedPodsOptions, ciCleanupRunsOptions, ciLogsOptions, isHelpArg, numberOption, publishTransportOption, requireDesiredRef, requireFullCommit, requireRepoRelativePath, requireRevision, requireServiceId, resolveCatalogArtifact, stringOption, userServicePublishBoundaryBlock } from "./options";
|
||||
import { backendCoreArtifactSourceHostPath, userServiceArtifactSourceHostPath } from "./pipelinerun";
|
||||
import { publishBackendCoreArtifact, publishUserServiceArtifact, run } from "./publish";
|
||||
import { ciTarget, d601ProviderId, providerIdOption } from "./types";
|
||||
import { ciTarget, ciTargetSourceSummary, providerIdOption } from "./types";
|
||||
|
||||
export async function runCiCommand(config: UniDeskConfig, args: string[]): Promise<Record<string, unknown>> {
|
||||
const [action = "status", nameArg] = args;
|
||||
@@ -44,6 +45,21 @@ export async function runCiCommand(config: UniDeskConfig, args: string[]): Promi
|
||||
return options.wait ? install(config, options) : installAsync(options);
|
||||
}
|
||||
if (action === "install-status") return installStatus(nameArg ?? "latest");
|
||||
if (action === "plan") {
|
||||
const target = ciTarget(providerIdOption(args));
|
||||
return {
|
||||
ok: true,
|
||||
action: "ci-plan",
|
||||
mutation: false,
|
||||
target: ciTargetSourceSummary(target),
|
||||
configTruth: target.configSource.configPath,
|
||||
next: {
|
||||
status: `bun scripts/cli.ts ci status --target ${target.targetId}`,
|
||||
installDryRun: `bun scripts/cli.ts ci install --target ${target.targetId} --skip-prewarm --skip-tekton-install`,
|
||||
run: `bun scripts/cli.ts ci run --target ${target.targetId} --revision <commit>`,
|
||||
},
|
||||
};
|
||||
}
|
||||
if (action === "status") return status(ciTarget(providerIdOption(args)));
|
||||
if (action === "run") {
|
||||
const target = ciTarget(providerIdOption(args));
|
||||
@@ -130,12 +146,12 @@ export async function runCiCommand(config: UniDeskConfig, args: string[]): Promi
|
||||
if (action === "logs") return logs(config, nameArg ?? "", ciTarget(providerIdOption(args)), ciLogsOptions(args));
|
||||
if (action === "cleanup-runs") return cleanupRuns(config, ciCleanupRunsOptions(args));
|
||||
if (action === "cleanup-failed-pods") return cleanupFailedPods(config, ciCleanupFailedPodsOptions(args));
|
||||
throw new Error("ci command must be one of: install, status, run, publish-backend-core, publish-user-service, run-dev-e2e, logs, cleanup-runs, cleanup-failed-pods");
|
||||
throw new Error("ci command must be one of: install, plan, status, run, publish-backend-core, publish-user-service, run-dev-e2e, logs, cleanup-runs, cleanup-failed-pods");
|
||||
}
|
||||
|
||||
export function startCiInstallJob(providerId = d601ProviderId): Record<string, unknown> {
|
||||
export function startCiInstallJob(targetId?: string): Record<string, unknown> {
|
||||
return installAsync({
|
||||
target: ciTarget(providerId),
|
||||
target: ciTarget(targetId ?? null),
|
||||
skipPrewarm: false,
|
||||
skipTektonInstall: false,
|
||||
wait: false,
|
||||
|
||||
Reference in New Issue
Block a user