Merge pull request #651 from pikasTech/fix/v02-agentrun-bundle-source-commit

fix: pin agentrun bundle to v02 source
This commit is contained in:
Lyon
2026-06-01 19:15:55 +08:00
committed by GitHub
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -832,6 +832,9 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
upsertEnv(container.env, "HWLAB_GITOPS_TARGET", gitopsTarget);
upsertEnv(container.env, "HWLAB_GITOPS_PROFILE", profileLabel);
upsertEnv(container.env, "HWLAB_GITOPS_SOURCE_COMMIT", profile === "v02" ? runtimeCommit : source.full);
if (profile === "v02" && serviceId === "hwlab-cloud-api") {
upsertEnv(container.env, "HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT", source.full);
}
if (bootMetadata) {
upsertEnv(container.env, "HWLAB_RUNTIME_MODE", bootMetadata.runtimeMode);
upsertEnv(container.env, "HWLAB_BOOT_REPO", bootMetadata.bootRepo);
+4
View File
@@ -225,6 +225,10 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
assert.ok(devicePodEnv.some((entry) => entry.name === "HWLAB_BOOT_SH" && entry.value === "deploy/runtime/boot/hwlab-device-pod.sh"));
assert.equal(devicePod.spec.template.metadata.annotations["hwlab.pikastech.local/runtime-mode"], "env-reuse-git-mirror-checkout");
assert.equal(devicePod.spec.template.metadata.annotations["hwlab.pikastech.local/boot-commit"], sourceRevision);
const cloudApi = workloadsJson.items.find((item) => item.metadata?.name === "hwlab-cloud-api");
assert.ok(cloudApi, "expected v02 hwlab-cloud-api workload");
const cloudApiEnv = cloudApi.spec.template.spec.containers[0].env;
assert.ok(cloudApiEnv.some((entry) => entry.name === "HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT" && entry.value === sourceRevision));
const agentWorker = workloadsJson.items.find((item) => item.metadata?.name === "hwlab-agent-worker");
const agentWorkerEnv = agentWorker?.spec?.template?.spec?.containers?.[0]?.env ?? [];
assert.equal(agentWorkerEnv.some((entry) => entry.name === "HWLAB_BOOT_COMMIT"), false, "agent-worker must not be switched to env reuse by device-pod work");