fix: bootstrap production runtime GitOps scripts
This commit is contained in:
@@ -106,6 +106,11 @@ delivery:
|
||||
configRef: config/hwlab-node-lanes.yaml#lanes.v03.targets.NC01
|
||||
manifestPath: deploy/gitops/unidesk-host/hwlab-nc01-v03-runtime-gitops-scripts.yaml
|
||||
namespace: hwlab-ci
|
||||
- id: hwlab-nc01-production-runtime-gitops-scripts
|
||||
renderer: hwlab-runtime-gitops-scripts
|
||||
configRef: config/hwlab-node-lanes.yaml#lanes.production.targets.NC01
|
||||
manifestPath: deploy/gitops/unidesk-host/hwlab-nc01-production-runtime-gitops-scripts.yaml
|
||||
namespace: hwlab-ci
|
||||
author:
|
||||
name: UniDesk Host CI
|
||||
email: unidesk-host-ci@unidesk.local
|
||||
|
||||
@@ -471,15 +471,27 @@ describe("HWLAB YAML-owned Pipeline provenance", () => {
|
||||
manifestPath: "deploy/gitops/unidesk-host/hwlab-nc01-v03-runtime-gitops-scripts.yaml",
|
||||
namespace: "hwlab-ci",
|
||||
});
|
||||
expect(hostConfig.delivery.gitops.resources).toContainEqual({
|
||||
id: "hwlab-nc01-production-runtime-gitops-scripts",
|
||||
renderer: "hwlab-runtime-gitops-scripts",
|
||||
configRef: "config/hwlab-node-lanes.yaml#lanes.production.targets.NC01",
|
||||
manifestPath: "deploy/gitops/unidesk-host/hwlab-nc01-production-runtime-gitops-scripts.yaml",
|
||||
namespace: "hwlab-ci",
|
||||
});
|
||||
const gitopsResources = renderGitOpsResources(hostConfig.delivery.gitops, rootPath());
|
||||
expect(gitopsResources).toHaveLength(1);
|
||||
expect(gitopsResources[0]?.path).toBe("deploy/gitops/unidesk-host/hwlab-nc01-v03-runtime-gitops-scripts.yaml");
|
||||
const gitopsConfigMap = Bun.YAML.parse(gitopsResources[0]?.content ?? "") as Record<string, any>;
|
||||
expect(gitopsResources).toHaveLength(2);
|
||||
const v03Resource = gitopsResources.find((resource) => resource.path.endsWith("hwlab-nc01-v03-runtime-gitops-scripts.yaml"));
|
||||
expect(v03Resource?.path).toBe("deploy/gitops/unidesk-host/hwlab-nc01-v03-runtime-gitops-scripts.yaml");
|
||||
const gitopsConfigMap = Bun.YAML.parse(v03Resource?.content ?? "") as Record<string, any>;
|
||||
expect(gitopsConfigMap.metadata.name).toBe("hwlab-nc01-v03-ci-image-publish-runtime-gitops-scripts");
|
||||
expect(gitopsConfigMap.metadata.namespace).toBe("hwlab-ci");
|
||||
expect(gitopsConfigMap.data["runtime-gitops-postprocess.mjs"]).toContain("UNIDESK_RUNTIME_GITOPS_OVERLAY_FILE");
|
||||
expect(gitopsConfigMap.data["runtime-gitops-postprocess.mjs"].indexOf("UNIDESK_RUNTIME_GITOPS_OVERLAY_FILE"))
|
||||
.toBeLessThan(gitopsConfigMap.data["runtime-gitops-postprocess.mjs"].indexOf("UNIDESK_RUNTIME_GITOPS_OVERLAY_B64"));
|
||||
const productionResource = gitopsResources.find((resource) => resource.path.endsWith("hwlab-nc01-production-runtime-gitops-scripts.yaml"));
|
||||
const productionConfigMap = Bun.YAML.parse(productionResource?.content ?? "") as Record<string, any>;
|
||||
expect(productionConfigMap.metadata.name).toBe("hwlab-nc01-production-ci-image-publish-runtime-gitops-scripts");
|
||||
expect(productionConfigMap.metadata.namespace).toBe("hwlab-ci");
|
||||
const legacyPayload = Buffer.from(JSON.stringify({ runtimePath: overlay.runtimePath, observability: overlay.observability }), "utf8").toString("base64");
|
||||
const legacyPipeline = Bun.YAML.parse(readFileSync(pipelinePath, "utf8")) as Record<string, any>;
|
||||
const legacyStep = legacyPipeline.spec.tasks[0].taskSpec.steps[0];
|
||||
|
||||
Reference in New Issue
Block a user