fix(cicd): 复用 TaskTree 共享运行环境
This commit is contained in:
@@ -23,6 +23,8 @@ spec:
|
|||||||
services:
|
services:
|
||||||
- hwlab-cloud-api
|
- hwlab-cloud-api
|
||||||
- hwlab-project-management
|
- hwlab-project-management
|
||||||
|
- hwlab-tasktree-api
|
||||||
|
- hwlab-tasktree-worker
|
||||||
- hwlab-cloud-web
|
- hwlab-cloud-web
|
||||||
- hwlab-gateway
|
- hwlab-gateway
|
||||||
- hwlab-edge-proxy
|
- hwlab-edge-proxy
|
||||||
@@ -138,6 +140,53 @@ spec:
|
|||||||
- package-lock.json
|
- package-lock.json
|
||||||
- deploy/runtime/launcher/hwlab-env-reuse-launcher.ts
|
- deploy/runtime/launcher/hwlab-env-reuse-launcher.ts
|
||||||
- internal/dev-entrypoint/artifact-runtime.mjs
|
- internal/dev-entrypoint/artifact-runtime.mjs
|
||||||
|
hwlab-tasktree-api:
|
||||||
|
runtimeReuse:
|
||||||
|
enabled: true
|
||||||
|
codeIdentity:
|
||||||
|
paths:
|
||||||
|
- cmd/hwlab-tasktree-api
|
||||||
|
- internal/tasktree
|
||||||
|
- tools/src/tasktree-cli.ts
|
||||||
|
- deploy/runtime/boot/hwlab-tasktree-api.sh
|
||||||
|
envIdentity:
|
||||||
|
paths:
|
||||||
|
- package.json
|
||||||
|
- package-lock.json
|
||||||
|
- deploy/runtime/launcher/hwlab-env-reuse-launcher.ts
|
||||||
|
- internal/dev-entrypoint/artifact-runtime.mjs
|
||||||
|
envReuse:
|
||||||
|
enabled: true
|
||||||
|
mode: env-reuse-git-mirror-checkout
|
||||||
|
nodeDepsPath: /opt/hwlab-env/node_modules
|
||||||
|
envIdentityFiles:
|
||||||
|
- package.json
|
||||||
|
- package-lock.json
|
||||||
|
- deploy/runtime/launcher/hwlab-env-reuse-launcher.ts
|
||||||
|
- internal/dev-entrypoint/artifact-runtime.mjs
|
||||||
|
hwlab-tasktree-worker:
|
||||||
|
runtimeReuse:
|
||||||
|
enabled: true
|
||||||
|
codeIdentity:
|
||||||
|
paths:
|
||||||
|
- cmd/hwlab-tasktree-worker
|
||||||
|
- internal/tasktree
|
||||||
|
- deploy/runtime/boot/hwlab-tasktree-worker.sh
|
||||||
|
envIdentity:
|
||||||
|
paths:
|
||||||
|
- package.json
|
||||||
|
- package-lock.json
|
||||||
|
- deploy/runtime/launcher/hwlab-env-reuse-launcher.ts
|
||||||
|
- internal/dev-entrypoint/artifact-runtime.mjs
|
||||||
|
envReuse:
|
||||||
|
enabled: true
|
||||||
|
mode: env-reuse-git-mirror-checkout
|
||||||
|
nodeDepsPath: /opt/hwlab-env/node_modules
|
||||||
|
envIdentityFiles:
|
||||||
|
- package.json
|
||||||
|
- package-lock.json
|
||||||
|
- deploy/runtime/launcher/hwlab-env-reuse-launcher.ts
|
||||||
|
- internal/dev-entrypoint/artifact-runtime.mjs
|
||||||
hwlab-cloud-web:
|
hwlab-cloud-web:
|
||||||
runtimeReuse:
|
runtimeReuse:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -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 () => {
|
test("v03 planner builds one shared Go env artifact for compatible Go services", async () => {
|
||||||
const repo = await createFixtureRepo({ catalog: false });
|
const repo = await createFixtureRepo({ catalog: false });
|
||||||
await addGoEnvReuseFixture(repo);
|
await addGoEnvReuseFixture(repo);
|
||||||
|
|||||||
Reference in New Issue
Block a user