Merge pull request #1505 from pikasTech/fix/hwlab-refresh-pipeline-name-1499

fix(cicd): align HWLAB refresh apply pipeline name
This commit is contained in:
Lyon
2026-07-04 09:42:13 +08:00
committed by GitHub
@@ -136,10 +136,17 @@ function renderControlPlane() {
async function applyPipeline() {
const pipelinePath = path.join(renderDir, overlay.tektonDir, "pipeline.yaml");
if (!existsSync(pipelinePath)) throw new Error(`rendered Pipeline missing: ${pipelinePath}`);
const pipelineText = readFileSync(pipelinePath, "utf8");
const pipeline = yamlModule().parse(pipelineText);
const pipelineName = pipeline?.metadata?.name;
if (typeof pipelineName !== "string" || pipelineName.length === 0) throw new Error(`rendered Pipeline metadata.name missing: ${pipelinePath}`);
const YAML = yamlModule();
const pipeline = YAML.parse(readFileSync(pipelinePath, "utf8"));
if (!pipeline || typeof pipeline !== "object") throw new Error(`rendered Pipeline is not an object: ${pipelinePath}`);
const renderedPipelineName = pipeline?.metadata?.name;
if (typeof renderedPipelineName !== "string" || renderedPipelineName.length === 0) {
throw new Error(`rendered Pipeline metadata.name missing: ${pipelinePath}`);
}
const pipelineName = requiredOverlayString("pipelineName");
pipeline.metadata = pipeline.metadata && typeof pipeline.metadata === "object" ? pipeline.metadata : {};
pipeline.metadata.name = pipelineName;
const pipelineText = YAML.stringify(pipeline);
await kubeRequest(
"PATCH",
`/apis/tekton.dev/v1/namespaces/${encodeURIComponent(tektonNamespace)}/pipelines/${encodeURIComponent(pipelineName)}?fieldManager=${encodeURIComponent(fieldManager)}&force=true`,