fix(cicd): 复用 TaskTree 共享运行环境

This commit is contained in:
root
2026-07-17 11:14:04 +02:00
parent 092f66f601
commit 16fed1bdba
2 changed files with 81 additions and 0 deletions
+32
View File
@@ -1483,6 +1483,38 @@ test("v03 planner reads env reuse declarations and catalog from v03 lane config"
}
});
test("v03 TaskTree API and worker share one TypeScript environment artifact", async () => {
const reuse = await readStructuredFile(process.cwd(), "gitops/reuse.ymal");
const group = reuse.spec?.envArtifactGroups?.["hwlab-ts-runtime-env"];
const services = reuse.spec?.services ?? {};
const tasktreeServiceIds = ["hwlab-tasktree-api", "hwlab-tasktree-worker"];
const expectedEnvIdentity = [
"package.json",
"package-lock.json",
"deploy/runtime/launcher/hwlab-env-reuse-launcher.ts",
"internal/dev-entrypoint/artifact-runtime.mjs"
];
assert.ok(group, "shared TypeScript environment group");
for (const serviceId of tasktreeServiceIds) {
assert.equal(group.services?.includes(serviceId), true, `${serviceId} shared environment membership`);
assert.deepEqual(services[serviceId]?.runtimeReuse?.envIdentity?.paths, expectedEnvIdentity, `${serviceId} runtime env identity`);
assert.deepEqual(services[serviceId]?.envReuse?.envIdentityFiles, expectedEnvIdentity, `${serviceId} env reuse identity`);
assert.equal(services[serviceId]?.envReuse?.mode, "env-reuse-git-mirror-checkout", `${serviceId} runtime mode`);
}
assert.deepEqual(services["hwlab-tasktree-api"].runtimeReuse.codeIdentity.paths, [
"cmd/hwlab-tasktree-api",
"internal/tasktree",
"tools/src/tasktree-cli.ts",
"deploy/runtime/boot/hwlab-tasktree-api.sh"
]);
assert.deepEqual(services["hwlab-tasktree-worker"].runtimeReuse.codeIdentity.paths, [
"cmd/hwlab-tasktree-worker",
"internal/tasktree",
"deploy/runtime/boot/hwlab-tasktree-worker.sh"
]);
});
test("v03 planner builds one shared Go env artifact for compatible Go services", async () => {
const repo = await createFixtureRepo({ catalog: false });
await addGoEnvReuseFixture(repo);