fix: unify HWLAB PaC Gitea repository URL
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
firstPacSourceArtifactDrift,
|
||||
inspectPacSourceEntrypoints,
|
||||
inspectPacServiceSelection,
|
||||
hwlabPacRepositoryUrlTemplate,
|
||||
pacSourceArtifactSafeError,
|
||||
pacSourceArtifactProvenanceFromManifest,
|
||||
pipelineRunLabels,
|
||||
@@ -101,6 +102,15 @@ function runtimeInput(commit: string | null = sourceCommit): Record<string, unkn
|
||||
}
|
||||
|
||||
describe("PaC source artifact CLI contract", () => {
|
||||
test("uses one Gitea repository URL parameter for every HWLAB Git operation", () => {
|
||||
expect(["git-read-url", "gitops-read-url", "git-write-url"].map(hwlabPacRepositoryUrlTemplate)).toEqual([
|
||||
"{{ git_read_url }}",
|
||||
"{{ git_read_url }}",
|
||||
"{{ git_read_url }}",
|
||||
]);
|
||||
expect(hwlabPacRepositoryUrlTemplate("source-branch")).toBeNull();
|
||||
});
|
||||
|
||||
test("consumer service selection drift is typed partial evidence and non-blocking", () => {
|
||||
const result = inspectPacServiceSelection({
|
||||
deployDeclarations: { source: "deploy/deploy.yaml#**.serviceId", serviceIds: ["api", "worker"] },
|
||||
|
||||
@@ -1076,6 +1076,8 @@ function pipelineRunParams(binding: PacSourceArtifactBinding, desiredSpec: Recor
|
||||
return params.map((param) => {
|
||||
const name = requiredString(param.name, "Pipeline.spec.params[].name");
|
||||
if (binding.consumer.sourceArtifact.renderer === "hwlab-runtime-lane") {
|
||||
const repositoryUrlTemplate = hwlabPacRepositoryUrlTemplate(name);
|
||||
if (repositoryUrlTemplate !== null) return { name, value: repositoryUrlTemplate };
|
||||
if (name === "release-base-commit") return { name, value: "{{ body.before }}" };
|
||||
if (name === "release-target") return { name, value: binding.consumer.node };
|
||||
if (name === "release-consumer") return { name, value: binding.consumer.id };
|
||||
@@ -1106,6 +1108,12 @@ function pipelineRunParams(binding: PacSourceArtifactBinding, desiredSpec: Recor
|
||||
});
|
||||
}
|
||||
|
||||
export function hwlabPacRepositoryUrlTemplate(name: string): string | null {
|
||||
return name === "git-read-url" || name === "gitops-read-url" || name === "git-write-url"
|
||||
? "{{ git_read_url }}"
|
||||
: null;
|
||||
}
|
||||
|
||||
export function pipelineRunWorkspaces(binding: PacSourceArtifactBinding, desiredSpec: Record<string, unknown>): Record<string, unknown>[] {
|
||||
if (desiredSpec.workspaces === undefined) return [];
|
||||
return arrayRecords(desiredSpec.workspaces, "Pipeline.spec.workspaces").map((workspace) => {
|
||||
|
||||
Reference in New Issue
Block a user