feat: migrate jd01 hwlab ci to gitea pac
This commit is contained in:
@@ -1954,11 +1954,17 @@ function targetSpec(raw: Record<string, unknown>, index: number): ControlPlaneTa
|
||||
function controlPlaneSourceAuthoritySpec(raw: Record<string, unknown>, path: string): ControlPlaneTargetSpec["source"]["sourceAuthority"] {
|
||||
const mode = stringField(raw, "mode", path);
|
||||
const resolver = stringField(raw, "resolver", path);
|
||||
if (mode !== "gitMirrorSnapshot") throw new Error(`${path}.mode must be gitMirrorSnapshot`);
|
||||
if (resolver !== "k8s-git-mirror") throw new Error(`${path}.resolver must be k8s-git-mirror`);
|
||||
if (mode !== "gitMirrorSnapshot" && mode !== "giteaSnapshot") throw new Error(`${path}.mode must be gitMirrorSnapshot or giteaSnapshot`);
|
||||
if (resolver !== "k8s-git-mirror" && resolver !== "gitea-mirror") throw new Error(`${path}.resolver must be k8s-git-mirror or gitea-mirror`);
|
||||
if (mode === "gitMirrorSnapshot" && resolver !== "k8s-git-mirror") throw new Error(`${path}.resolver must be k8s-git-mirror when mode is gitMirrorSnapshot`);
|
||||
if (mode === "giteaSnapshot" && resolver !== "gitea-mirror") throw new Error(`${path}.resolver must be gitea-mirror when mode is giteaSnapshot`);
|
||||
const giteaMirrorRepoKey = optionalStringField(raw, "giteaMirrorRepoKey", path);
|
||||
if (mode === "giteaSnapshot" && giteaMirrorRepoKey === undefined) throw new Error(`${path}.giteaMirrorRepoKey is required when mode is giteaSnapshot`);
|
||||
if (giteaMirrorRepoKey !== undefined && !/^[A-Za-z0-9._-]+$/u.test(giteaMirrorRepoKey)) throw new Error(`${path}.giteaMirrorRepoKey must be a simple Gitea mirror repo key`);
|
||||
return {
|
||||
mode,
|
||||
resolver,
|
||||
...(giteaMirrorRepoKey === undefined ? {} : { giteaMirrorRepoKey }),
|
||||
allowHostGit: falseBooleanField(raw, "allowHostGit", path),
|
||||
allowHostWorkspace: falseBooleanField(raw, "allowHostWorkspace", path),
|
||||
allowGithubDirectInPipeline: falseBooleanField(raw, "allowGithubDirectInPipeline", path),
|
||||
@@ -1973,7 +1979,7 @@ function controlPlaneSourceSnapshotSpec(raw: Record<string, unknown>, path: stri
|
||||
const missingObjectPolicy = stringField(raw, "missingObjectPolicy", path);
|
||||
const refreshPolicy = stringField(raw, "refreshPolicy", path);
|
||||
if (missingObjectPolicy !== "fail-fast") throw new Error(`${path}.missingObjectPolicy must be fail-fast`);
|
||||
if (refreshPolicy !== "sync-before-snapshot") throw new Error(`${path}.refreshPolicy must be sync-before-snapshot`);
|
||||
if (refreshPolicy !== "sync-before-snapshot" && refreshPolicy !== "gitea-controlled-snapshot") throw new Error(`${path}.refreshPolicy must be sync-before-snapshot or gitea-controlled-snapshot`);
|
||||
return { stageRefPrefix, missingObjectPolicy, refreshPolicy };
|
||||
}
|
||||
|
||||
@@ -2126,7 +2132,7 @@ function tektonArgoObserverRole(target: ControlPlaneTargetSpec, labels: Record<s
|
||||
{
|
||||
apiGroups: ["argoproj.io"],
|
||||
resources: ["applications"],
|
||||
verbs: ["get", "list", "watch"],
|
||||
verbs: ["get", "list", "watch", "patch"],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user