fix: keep v02 config hashes label-safe

This commit is contained in:
Codex
2026-05-31 12:37:46 +08:00
parent 794bea65e8
commit 15294ee30d
3 changed files with 21 additions and 4 deletions
+12 -2
View File
@@ -243,12 +243,22 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
}
const frpc = JSON.parse(await readFile(path.join(outDir, "runtime-v02", "g14-frpc.yaml"), "utf8"));
const frpcDeployment = frpc.items.find((item) => item.kind === "Deployment");
assert.ok(frpcDeployment.spec.template.metadata.labels["hwlab.pikastech.local/config-sha256"]);
const frpcConfigLabel = frpcDeployment.spec.template.metadata.labels["hwlab.pikastech.local/config-sha256"];
const frpcConfigAnnotation = frpcDeployment.spec.template.metadata.annotations["hwlab.pikastech.local/config-sha256"];
assert.ok(frpcConfigLabel);
assert.equal(frpcConfigLabel.length <= 63, true);
assert.match(frpcConfigAnnotation, /^[a-f0-9]{64}$/u);
assert.equal(frpcConfigAnnotation.startsWith(frpcConfigLabel), true);
assert.equal(frpcDeployment.spec.template.metadata.labels["hwlab.pikastech.local/source-commit"], undefined);
const postgres = JSON.parse(await readFile(path.join(outDir, "runtime-v02", "postgres.yaml"), "utf8"));
const postgresStatefulSet = postgres.items.find((item) => item.kind === "StatefulSet");
assert.ok(postgresStatefulSet.spec.template.metadata.labels["hwlab.pikastech.local/migration-sha256"]);
const postgresMigrationLabel = postgresStatefulSet.spec.template.metadata.labels["hwlab.pikastech.local/migration-sha256"];
const postgresMigrationAnnotation = postgresStatefulSet.spec.template.metadata.annotations["hwlab.pikastech.local/migration-sha256"];
assert.ok(postgresMigrationLabel);
assert.equal(postgresMigrationLabel.length <= 63, true);
assert.match(postgresMigrationAnnotation, /^[a-f0-9]{64}$/u);
assert.equal(postgresMigrationAnnotation.startsWith(postgresMigrationLabel), true);
assert.equal(postgresStatefulSet.spec.template.metadata.labels["hwlab.pikastech.local/source-commit"], undefined);
await assert.rejects(() => readFile(path.join(outDir, "tekton-v02", "control-plane-reconciler.yaml"), "utf8"), { code: "ENOENT" });