fix(cicd): render agentrun PaC token per lane

This commit is contained in:
Codex
2026-07-08 20:05:39 +02:00
parent 56ff8a2bf2
commit 877d78e68e
+7 -1
View File
@@ -281,7 +281,7 @@ function agentRunBuildPublishTask(spec: AgentRunLaneSpec): Record<string, unknow
name: "publish-gitops", name: "publish-gitops",
image: "$(params.tools-image)", image: "$(params.tools-image)",
env: [ env: [
{ name: "GITEA_TOKEN", valueFrom: { secretKeyRef: { name: "pac-gitea-agentrun-jd01-v02", key: "token", optional: true } } }, { name: "GITEA_TOKEN", valueFrom: { secretKeyRef: { name: agentRunPacGiteaSecretName(spec), key: "token", optional: true } } },
], ],
script: agentRunTektonGitopsPublishScript(spec), script: agentRunTektonGitopsPublishScript(spec),
}, },
@@ -773,6 +773,12 @@ function agentRunLabels(spec: AgentRunLaneSpec): Record<string, string> {
}; };
} }
function agentRunPacGiteaSecretName(spec: AgentRunLaneSpec): string {
const consumerId = spec.ci.pipelineRunPrefix.replace(/-ci$/u, "");
if (consumerId === spec.ci.pipelineRunPrefix) throw new Error(`config/agentrun.yaml controlPlane.lanes.${spec.lane}.ci.pipelineRunPrefix must end with -ci`);
return `pac-gitea-${consumerId}`;
}
function yaml(value: unknown): string { function yaml(value: unknown): string {
return `${Bun.YAML.stringify(value).trim()}\n`; return `${Bun.YAML.stringify(value).trim()}\n`;
} }