chore: add cicd legacy cleanup precheck
This commit is contained in:
@@ -71,6 +71,7 @@ const defaultOptions: ArtifactRegistryOptions = {
|
||||
};
|
||||
const supportedArtifactConsumerServices = ["backend-core", "baidu-netdisk", "decision-center", "frontend"] as const;
|
||||
type SupportedArtifactConsumerService = typeof supportedArtifactConsumerServices[number];
|
||||
const legacyDeployBackendCoreDisabled = true;
|
||||
|
||||
interface ArtifactConsumerSpec {
|
||||
serviceId: SupportedArtifactConsumerService;
|
||||
@@ -1108,6 +1109,20 @@ function deployBackendCoreJob(args: string[], options: ArtifactRegistryOptions):
|
||||
};
|
||||
}
|
||||
|
||||
function legacyDeployBackendCoreResult(options: ArtifactRegistryOptions): Record<string, unknown> {
|
||||
return {
|
||||
ok: false,
|
||||
supported: false,
|
||||
deprecated: true,
|
||||
action: "deploy-backend-core",
|
||||
replacement: "bun scripts/cli.ts deploy apply --env prod --service backend-core --commit <full-sha>",
|
||||
serviceId: "backend-core",
|
||||
environment: options.environment ?? "prod",
|
||||
commit: options.commit,
|
||||
policy: "backend-core production CD must enter through deploy apply --env prod so the standard artifact-consumer guardrails run before any mutation; the legacy artifact-registry deploy-backend-core entry is retained only as a documented compatibility name.",
|
||||
};
|
||||
}
|
||||
|
||||
function dryRunArtifactConsumerPlan(options: ArtifactRegistryOptions, spec: ArtifactConsumerSpec, target: ArtifactConsumerTarget, commit: string): Record<string, unknown> {
|
||||
const environment = options.environment ?? "prod";
|
||||
const sourceImage = artifactImageRef(options, spec, commit);
|
||||
@@ -1458,7 +1473,6 @@ function localHelp(): Record<string, unknown> {
|
||||
"bun scripts/cli.ts artifact-registry status [--provider-id D601]",
|
||||
"bun scripts/cli.ts artifact-registry health [--provider-id D601]",
|
||||
"bun scripts/cli.ts artifact-registry install [--provider-id D601]",
|
||||
"bun scripts/cli.ts artifact-registry deploy-backend-core --commit <full-sha> [--run-now] [--provider-id D601]",
|
||||
"bun scripts/cli.ts artifact-registry deploy-service --service baidu-netdisk --commit <full-sha> [--dry-run] [--run-now] [--provider-id D601]",
|
||||
"bun scripts/cli.ts artifact-registry deploy-service --service frontend --env prod --commit <full-sha> [--dry-run] [--run-now] [--provider-id D601]",
|
||||
"bun scripts/cli.ts artifact-registry deploy-service --service frontend --env dev --commit <full-sha> [--dry-run] [--run-now] [--provider-id D601]",
|
||||
@@ -1482,6 +1496,13 @@ function localHelp(): Record<string, unknown> {
|
||||
],
|
||||
rollbackShape: "rerun the same artifact consumer with a previous commit-pinned image",
|
||||
},
|
||||
legacyEntrypoints: {
|
||||
"deploy-backend-core": {
|
||||
deprecated: true,
|
||||
enabled: !legacyDeployBackendCoreDisabled,
|
||||
replacement: "bun scripts/cli.ts deploy apply --env prod --service backend-core --commit <full-sha>",
|
||||
},
|
||||
},
|
||||
defaults: defaultOptions,
|
||||
};
|
||||
}
|
||||
@@ -1503,6 +1524,7 @@ export async function runArtifactRegistryCommand(args: string[]): Promise<unknow
|
||||
}
|
||||
if (action === "deploy-backend-core") {
|
||||
if (options.commit === null) throw new Error("artifact-registry deploy-backend-core requires --commit <full-sha>");
|
||||
if (legacyDeployBackendCoreDisabled) return legacyDeployBackendCoreResult(options);
|
||||
return options.runNow ? await deployBackendCoreNow(options) : deployBackendCoreJob(args, options);
|
||||
}
|
||||
if (action === "deploy-service") {
|
||||
|
||||
Reference in New Issue
Block a user