chore: add cicd legacy cleanup precheck

This commit is contained in:
Codex
2026-05-20 00:27:51 +00:00
parent fced0520fe
commit 240ff7bdb1
18 changed files with 283 additions and 12 deletions
+25
View File
@@ -51,6 +51,14 @@ export interface UniDeskMicroserviceConfig {
url: string;
commitId: string;
dockerfile: string;
artifactSource?: {
kind: "upstream-image";
imageRef: string;
digestPinRequired: boolean;
mirrorRepository: string;
ciDockerfileBuild: boolean;
pullOnlyCd: boolean;
};
composeFile: string;
composeService: string;
containerName: string;
@@ -150,6 +158,22 @@ function stringArrayField(obj: Record<string, unknown>, key: string, path: strin
return value as string[];
}
function optionalArtifactSource(repository: Record<string, unknown>, path: string): UniDeskMicroserviceConfig["repository"]["artifactSource"] {
const value = repository.artifactSource;
if (value === undefined) return undefined;
const source = asRecord(value, `${path}.artifactSource`);
const kind = stringField(source, "kind", `${path}.artifactSource`);
if (kind !== "upstream-image") throw new Error(`${path}.artifactSource.kind must be upstream-image`);
return {
kind,
imageRef: stringField(source, "imageRef", `${path}.artifactSource`),
digestPinRequired: booleanField(source, "digestPinRequired", `${path}.artifactSource`),
mirrorRepository: stringField(source, "mirrorRepository", `${path}.artifactSource`),
ciDockerfileBuild: booleanField(source, "ciDockerfileBuild", `${path}.artifactSource`),
pullOnlyCd: booleanField(source, "pullOnlyCd", `${path}.artifactSource`),
};
}
function optionalRestrictedHostAccess(network: Record<string, unknown>): UniDeskConfig["network"]["restrictedHostAccess"] {
const value = network.restrictedHostAccess;
if (value === undefined) return undefined;
@@ -182,6 +206,7 @@ function microserviceConfig(item: Record<string, unknown>, index: number): UniDe
url: stringField(repository, "url", `${path}.repository`),
commitId: stringField(repository, "commitId", `${path}.repository`),
dockerfile: stringField(repository, "dockerfile", `${path}.repository`),
artifactSource: optionalArtifactSource(repository, `${path}.repository`),
composeFile: stringField(repository, "composeFile", `${path}.repository`),
composeService: stringField(repository, "composeService", `${path}.repository`),
containerName: stringField(repository, "containerName", `${path}.repository`),