fix: skip v02 runtime-ready for source-only releases (#984)
Co-authored-by: Codex Agent <codex@hwlab.local>
This commit is contained in:
@@ -940,7 +940,7 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
|
||||
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);
|
||||
upsertEnv(container.env, "HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT", runtimeCommit);
|
||||
}
|
||||
if (bootMetadata) {
|
||||
upsertEnv(container.env, "HWLAB_RUNTIME_MODE", bootMetadata.runtimeMode);
|
||||
@@ -1892,9 +1892,6 @@ function scrub(value) {
|
||||
if (Array.isArray(value)) return value.map(scrub);
|
||||
if (!value || typeof value !== "object") return value;
|
||||
const result = {};
|
||||
const semanticRuntimeCommitEnvNames = new Set([
|
||||
"HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT"
|
||||
]);
|
||||
for (const [key, child] of Object.entries(value)) {
|
||||
if (key === "hwlab.pikastech.local/source-commit" ||
|
||||
key === "hwlab.pikastech.local/artifact-source-commit" ||
|
||||
@@ -1905,7 +1902,7 @@ function scrub(value) {
|
||||
continue;
|
||||
}
|
||||
const envName = String(value.name || "");
|
||||
if (key === "value" && /^HWLAB_.*COMMIT/.test(envName) && !semanticRuntimeCommitEnvNames.has(envName)) {
|
||||
if (key === "value" && /^HWLAB_.*COMMIT/.test(envName)) {
|
||||
result[key] = "<runtime-source-identity>";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -140,8 +140,6 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
|
||||
assert.match(gitopsPromoteScript, /runtime-identity-only/u);
|
||||
assert.match(gitopsPromoteScript, /skipped-runtime-unchanged/u);
|
||||
assert.match(gitopsPromoteScript, /printf 'false' > \/tekton\/results\/runtime-ready-required/u);
|
||||
assert.match(gitopsPromoteScript, /HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT/u);
|
||||
assert.match(gitopsPromoteScript, /semanticRuntimeCommitEnvNames\.has\(envName\)/u);
|
||||
assert.equal(await runtimeNoopDecision(gitopsPromoteScript, {
|
||||
oldRuntime: {
|
||||
runtimeCommit: "1111111111111111111111111111111111111111",
|
||||
@@ -152,16 +150,6 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
|
||||
agentRunBundleCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
}
|
||||
}), "runtime-identity-only");
|
||||
assert.equal(await runtimeNoopDecision(gitopsPromoteScript, {
|
||||
oldRuntime: {
|
||||
runtimeCommit: "1111111111111111111111111111111111111111",
|
||||
agentRunBundleCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
},
|
||||
newRuntime: {
|
||||
runtimeCommit: "2222222222222222222222222222222222222222",
|
||||
agentRunBundleCommit: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
|
||||
}
|
||||
}), "runtime-required");
|
||||
assert.match(gitopsPromoteScript, /argo_hard_refresh_v02\(\) \{/u);
|
||||
assert.match(gitopsPromoteScript, /argocd\.argoproj\.io\/refresh": "hard"/u);
|
||||
assert.match(gitopsPromoteScript, /applications\/" \+ encodeURIComponent\(application\) \+ "\?fieldManager=hwlab-v02-gitops-promote/u);
|
||||
@@ -365,7 +353,8 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
|
||||
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 cloudApiCommit = cloudApiEnv.find((entry) => entry.name === "HWLAB_COMMIT_ID")?.value;
|
||||
assert.ok(cloudApiEnv.some((entry) => entry.name === "HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT" && entry.value === cloudApiCommit));
|
||||
assert.ok(cloudApiEnv.some((entry) => entry.name === "HWLAB_CODE_AGENT_ADAPTER" && entry.value === "agentrun-v01"));
|
||||
assert.equal(cloudApi.spec.template.spec.initContainers?.some((entry) => entry.name === "hwlab-code-agent-workspace-init"), false);
|
||||
assert.equal(cloudApi.spec.template.spec.volumes?.some((entry) => /code-agent-codex|code-agent-workspace/u.test(entry.name)), false);
|
||||
|
||||
Reference in New Issue
Block a user