release(hermes): bind block-style HUX build metadata

The env setters moved to block style so Flux can rewrite them; the
renderer belt now matches the same shape and the release test asserts
the bound value lines rather than the old flow mapping.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BvMSXH8VH2tMWXanb8SJdf
This commit is contained in:
jenkins 2026-08-24 11:21:35 -03:00
parent 09ba5f8ac0
commit 043aa9ee89
2 changed files with 17 additions and 9 deletions

View File

@ -101,8 +101,12 @@ def render_hux_build_metadata(
"HUX_IMAGE_DIGEST": digest, "HUX_IMAGE_DIGEST": digest,
} }
rendered = source rendered = source
# Block style only: Flux setters cannot attach to values inside flow
# mappings, so the manifest keeps these as two-line entries with the
# marker comment on the value scalar. The renderer stays a belt on top
# of the Flux :tag/:digest setters and binds the same values.
present = { present = {
name: rendered.count(f"- {{name: {name}, value:") for name in replacements name: rendered.count(f"- name: {name}\n") for name in replacements
} }
if set(present.values()) == {0}: if set(present.values()) == {0}:
return rendered return rendered
@ -110,13 +114,13 @@ def render_hux_build_metadata(
raise ValueError(f"incomplete HUX build binding fields: {present}") raise ValueError(f"incomplete HUX build binding fields: {present}")
for name, value in replacements.items(): for name, value in replacements.items():
pattern = re.compile( pattern = re.compile(
rf"^(?P<indent>\s*)- \{{name: {name}, value: '[^'\n]+'\}}(?P<suffix>[^\n]*)$", rf"^(?P<head>(?P<indent>\s*)- name: {name}\n(?P=indent) value: )"
rf"[^#\n]+(?P<suffix> #[^\n]*)?$",
re.MULTILINE, re.MULTILINE,
) )
rendered, count = pattern.subn( rendered, count = pattern.subn(
lambda match: ( lambda match: (
f"{match.group('indent')}- {{name: {name}, value: '{value}'}}" f"{match.group('head')}{value}{match.group('suffix') or ''}"
f"{match.group('suffix')}"
), ),
rendered, rendered,
) )

View File

@ -195,11 +195,15 @@ def test_renderer_updates_exact_chat_and_dashboard_webui_only(tmp_path: Path) ->
) )
assert patch.count(f"+ image: {module.DEFAULT_IMAGE}@{digest}") == chat_consumers + 1 assert patch.count(f"+ image: {module.DEFAULT_IMAGE}@{digest}") == chat_consumers + 1
if "HUX_IMAGE_TAG" in CHAT.read_text(encoding="utf-8"): if "HUX_IMAGE_TAG" in CHAT.read_text(encoding="utf-8"):
assert ( tag = f"git-{kwargs['source_revision']}-build-{kwargs['build_number']}-release"
"+ - {name: HUX_IMAGE_TAG, value: " assert any(
f"'git-{kwargs['source_revision']}-build-{kwargs['build_number']}-release'}}" line.startswith("+") and line.lstrip("+ ").startswith(f"value: {tag}")
) in patch for line in patch.splitlines()
assert f"+ - {{name: HUX_IMAGE_DIGEST, value: '{digest}'}}" in patch ), patch
assert any(
line.startswith("+") and line.lstrip("+ ").startswith(f"value: {digest}")
for line in patch.splitlines()
), patch
assert "services/hermes/chat-statefulset.yaml" in patch assert "services/hermes/chat-statefulset.yaml" in patch
assert "services/hermes/deployment.yaml" in patch assert "services/hermes/deployment.yaml" in patch
assert "hermes-agent@sha256" not in "\n".join( assert "hermes-agent@sha256" not in "\n".join(