Merge pull request #2147 from pikasTech/fix/pikaoa-pac-shared-repository
fix(pikaoa): 共享 PaC Repository 并隔离 release lane
This commit is contained in:
@@ -253,45 +253,6 @@ repositories:
|
||||
runtime_service_port: "8080"
|
||||
health_path: /healthz
|
||||
health_url: http://pikaoa-web.pikaoa-test.svc.cluster.local:8080/healthz
|
||||
- id: pikaoa-nc01
|
||||
name: pikaoa-nc01
|
||||
namespace: pikaoa-ci
|
||||
providerType: gitea
|
||||
url: https://gitea.pikapython.com/mirrors/pikainc-pikaoa
|
||||
cloneUrl: http://gitea-http.devops-infra.svc.cluster.local:3000/mirrors/pikainc-pikaoa.git
|
||||
owner: mirrors
|
||||
repo: pikainc-pikaoa
|
||||
secretName: pac-gitea-pikaoa-nc01
|
||||
tokenKey: token
|
||||
webhookSecretKey: webhook.secret
|
||||
concurrencyLimit: 1
|
||||
params:
|
||||
git_read_url: http://gitea-http.devops-infra.svc.cluster.local:3000/mirrors/pikainc-pikaoa.git
|
||||
source_branch: release
|
||||
source_snapshot_prefix: refs/unidesk/snapshots/gitea-actions/pikaoa-release-nc01
|
||||
node: NC01
|
||||
pipeline_name: pikaoa-nc01-pac
|
||||
pipeline_run_prefix: pikaoa-nc01
|
||||
service_account: pikaoa-nc01-tekton-runner
|
||||
pipeline_timeout: 20m0s
|
||||
workspace_pvc_size: 8Gi
|
||||
image_repository: 127.0.0.1:5000/pikaoa/api
|
||||
api_image_repository: 127.0.0.1:5000/pikaoa/api
|
||||
worker_image_repository: 127.0.0.1:5000/pikaoa/worker
|
||||
web_image_repository: 127.0.0.1:5000/pikaoa/web
|
||||
registry_probe_base: http://127.0.0.1:5000
|
||||
gitops_read_url: http://gitea-http.devops-infra.svc.cluster.local:3000/mirrors/pikainc-pikaoa.git
|
||||
gitops_write_url: http://gitea-http.devops-infra.svc.cluster.local:3000/mirrors/pikainc-pikaoa.git
|
||||
gitops_branch: nc01-pikaoa-gitops
|
||||
gitops_username: unidesk-admin
|
||||
gitops_secret_name: pac-gitea-pikaoa-nc01
|
||||
gitops_manifest_path: deploy/gitops/nc01/resources.yaml
|
||||
runtime_namespace: pikaoa
|
||||
runtime_deployment: pikaoa-api
|
||||
runtime_service: pikaoa-web
|
||||
runtime_service_port: "8080"
|
||||
health_path: /healthz
|
||||
health_url: http://pikaoa-web.pikaoa.svc.cluster.local:8080/healthz
|
||||
consumers:
|
||||
- extends: templates.consumers.agentrunV02
|
||||
variables:
|
||||
@@ -549,7 +510,7 @@ consumers:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
fsGroup: 1000
|
||||
- id: pikaoa-nc01
|
||||
repositoryRef: pikaoa-nc01
|
||||
repositoryRef: pikaoa-test-nc01
|
||||
node: NC01
|
||||
lane: pikaoa
|
||||
namespace: pikaoa-ci
|
||||
|
||||
@@ -16,7 +16,16 @@ function rendererBinding(id = "pikaoa-test-nc01"): Parameters<typeof renderPikao
|
||||
const consumer = consumers.find((item) => item.id === id);
|
||||
const repository = repositories.find((item) => item.id === consumer?.repositoryRef);
|
||||
if (repository === undefined || consumer === undefined) throw new Error(`PikaOA PaC fixture is required: ${id}`);
|
||||
return { consumer, repository } as Parameters<typeof renderPikaoaTestDesiredPipeline>[0];
|
||||
return {
|
||||
consumer,
|
||||
repository: {
|
||||
...repository,
|
||||
params: {
|
||||
...(repository.params as Record<string, unknown>),
|
||||
...((consumer.params as Record<string, unknown> | undefined) ?? {}),
|
||||
},
|
||||
},
|
||||
} as Parameters<typeof renderPikaoaTestDesiredPipeline>[0];
|
||||
}
|
||||
|
||||
function sourceFixture(): string {
|
||||
@@ -27,21 +36,21 @@ function sourceFixture(): string {
|
||||
}
|
||||
|
||||
describe("PikaOA test PaC renderer", () => {
|
||||
test("keeps master test and release production consumers isolated", () => {
|
||||
test("shares one PaC repository while isolating master and release consumers", () => {
|
||||
const document = pacDocument();
|
||||
const repositories = document.repositories as Array<Record<string, unknown>>;
|
||||
const consumers = document.consumers as Array<Record<string, unknown>>;
|
||||
const repository = repositories.find((item) => item.id === "pikaoa-test-nc01");
|
||||
const testConsumer = consumers.find((item) => item.id === "pikaoa-test-nc01");
|
||||
const productionConsumer = consumers.find((item) => item.id === "pikaoa-nc01");
|
||||
const productionRepository = repositories.find((item) => item.id === "pikaoa-nc01");
|
||||
const duplicateProductionRepository = repositories.find((item) => item.id === "pikaoa-nc01");
|
||||
expect((repository?.params as Record<string, unknown>).source_branch).toBe("master");
|
||||
expect((testConsumer?.sourceArtifact as Record<string, unknown>).pipelineRunPath).toBe(".tekton/pikaoa-test-nc01-pac.yaml");
|
||||
expect((testConsumer?.sourceArtifact as Record<string, unknown>).renderer).toBe("pikaoa-test-runtime");
|
||||
expect((productionConsumer?.params as Record<string, unknown>).source_branch).toBe("release");
|
||||
expect((productionConsumer?.params as Record<string, unknown>).source_snapshot_prefix).toBe("refs/unidesk/snapshots/gitea-actions/pikaoa-release-nc01");
|
||||
expect(productionConsumer?.repositoryRef).toBe("pikaoa-nc01");
|
||||
expect((productionRepository?.params as Record<string, unknown>).source_branch).toBe("release");
|
||||
expect(productionConsumer?.repositoryRef).toBe("pikaoa-test-nc01");
|
||||
expect(duplicateProductionRepository).toBeUndefined();
|
||||
expect((productionConsumer?.sourceArtifact as Record<string, unknown>).renderer).toBe("pikaoa-release-runtime");
|
||||
expect((productionConsumer?.sourceArtifact as Record<string, unknown>).configRef).toBe("config/pikaoa.yaml#releaseRuntime.targets.NC01");
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ test("unselected parse and repository errors remain warnings while selected obje
|
||||
evidence: expect.stringMatching(/^type=string,length=\d+,sha256=[0-9a-f]{64}$/u),
|
||||
});
|
||||
expect(validPacConsumers(isolated).some((consumer) => consumer.repositoryRef === "pikaoa-test-nc01")).toBe(false);
|
||||
expect(() => parsePacConfigDocument(invalidRepositoryDocument, { consumerId: "pikaoa-nc01" })).not.toThrow();
|
||||
expect(() => parsePacConfigDocument(invalidRepositoryDocument, { consumerId: "pikaoa-nc01" })).toThrow("cloneUrl");
|
||||
|
||||
const duplicateSelectedRepository = pacConfigDocument();
|
||||
const repositories = duplicateSelectedRepository.repositories as Array<Record<string, unknown>>;
|
||||
|
||||
Reference in New Issue
Block a user