Skip to content

feat(release): a release is cut only after every argo cd application builds at the release head and its live changes are shown #1343

Closed

Description

@dan-petty

Ready: implementation plan (refined 2026-10-17 at 3dd7fa6)

This section supersedes any text below that conflicts with it.

Decisions

  • With no cluster context, the blocking gate still runs, because it is offline and needs no cluster. Only the live part (the diff, and whether the live overrides cover the release's hosts) needs a cluster, and that part is a report: with no Argo CD server, token or argocd binary, it is skipped with one warning and the cut goes on. A release must not depend on reaching the homelab, and the offline gate catches both failures feat(release): v0.2.28 #1283 hit: a kustomization that does not build (fix(k8s): resolve argocd application out-of-sync and manifest generation failures #1279), and placeholder values that no override replaces (fix(k8s): argo cd takes homelab values from deploy-time overrides, and the repository holds no private or placeholder config #1290).
  • Which Applications are built: every kind: Application under k8s/argocd/apps and k8s/argocd/bootstrap, discovered by reading the files and never listed by hand. Each git source with a path is built: the 8 Kustomize Applications (base, devops, gpu-feature-discovery, ingress, llm, logging, monitoring, otel) and the two directory Applications bootstrap and cluster. The 14 Helm Applications are not rendered, because their chart comes from a remote chart repository, so a render would not be offline. Their git part is checked instead: each $<ref>/<file> value file must exist in the tree and parse as YAML.
  • How a path is built: kubectl kustomize for a directory with a kustomization, or every YAML file parsed for a plain directory, as render_manifest_path already decides (src/devops_cli/k8s/template.py:126-145). A path holding Chart.yaml, a path outside the tree, or a git source whose repoURL is not this repository's origin fails the gate as one it cannot build offline. None exists today.
  • Build from the commit, not the working tree: the gate exports the fetched release tip with git archive <origin/release/vX.Y.Z> into a temporary directory, so a gitignored local file (the fix(k8s): resolve argocd application out-of-sync and manifest generation failures #1279 configmap.yaml) cannot hide a broken kustomization. Measured at 3dd7fa6: exporting the whole tree takes 0.26 s, and 0.9 s with the 8 Kustomize builds.
  • The offline placeholder rule: a template domain value (CONST_K8S_TEMPLATE_DOMAIN_PLACEHOLDER or a $DOMAIN variable, the same values render_manifest_template replaces) may appear only in a host field that host_patches rewrites (_host_fields, src/devops_cli/k8s/argocd_overrides.py:108). That host field must sit in an Application that deploy-stack patches (CONST_K8S_ARGOCD_HOMELAB_APPLICATIONS, src/devops_cli/config/constants.py:679). Any other occurrence fails, in a rendered object or in a Helm value file, keys included, naming the Application, the object and the JSON pointer. The live overrides are exactly host_patches of the render, so a placeholder anywhere else is never replaced. At 3dd7fa6 every occurrence (one line in devops, 23 in ingress) sits in such a field, so the rule passes today.
  • Is kubectl required wherever a cut runs: yes. It is pinned in tools.lock (1.37.1, src/devops_cli/tools_lock/tools.lock:27-28), and render_at_revision already builds with it. Without kubectl the gate fails, naming devops install-tools --tool kubectl. A repository with no k8s/argocd directory has no Applications and passes.
  • The live diff uses the argocd binary, not the REST API. The binary is pinned (3.5.4, tools.lock:127-128) and applies Argo CD's own normalization and ignoreDifferences. A REST diff would re-implement them. The call is argocd app diff <app> --revision <release tip sha> --grpc-web, with --source-positions <n> --revisions <sha> for the git source of a multi-source Application. The server and token come from the configured argocd.url and Argo CD token, as _argocd resolves them (src/devops_cli/commands/argo.py:162-179). They are passed as ARGOCD_SERVER and ARGOCD_AUTH_TOKEN in the environment, never in argv. Exit codes, from argocd app diff --help: 0 is no diff, 1 is a diff, 2 is an error.
  • The live override check (report only): for each homelab Application, argocd app get <app> -o json reads spec.source.kustomize.patches. Every placeholder host at the release tip that no live test operation names is reported, with devops k8s deploy-stack --stack <stack> to run after the merge (CONST_K8S_ARGOCD_HOMELAB_APPLICATIONS_BY_STACK, constants.py:681). It cannot block: deploy-stack computes patches from the revision Argo CD tracks (main), so a host the release adds can only be patched after the merge.
  • The image bullet is dropped. refactor(release): the release no longer pins, bumps or pre-publishes the service image tag; image updater rolls service:latest #1486 removed image pinning, and Image Updater rolls service:latest.
  • Where the gate runs: in cut_release, right after _fetch_remote_release_tip (src/devops_cli/release/cut.py:1065) and before _checkout_cut_branch (:1066). That is before any branch, file, commit, push or pull request. Every cut path goes through it: release prepare --create-pr (src/devops_cli/commands/release.py:299), release pr (:365), roadmap close --confirm (src/devops_cli/commands/roadmap.py:483) and the Service's close job (src/devops_cli/roadmap/run.py:519). The call site is the same whether the cut pushes release/vX.Y.Z (today) or opens chore/cut-vX.Y.Z as a pull request (the cut-as-a-pull-request change), so this plan assumes neither.
  • Module: src/devops_cli/k8s/argocd_gate.py, beside argocd_overrides.py, not release/. The cut only calls it, and tests/test_k8s_argocd_apps.py shares its discovery. The live report goes in src/devops_cli/k8s/argocd_live_report.py. The token resolution moves out of the Typer command into a function that raises a typed error, and devops argo and the report both use it.
  • The roadmap job's cut: the shared cut_release gives it the gate, but the Service is suspended (chore(service): the roadmap service stays at 0 replicas, and its development is blocked, while its machine account is suspended #1562) and its image has no kubectl (Dockerfile:25-41). The Service's cut passing the gate stays out of this delivery: see Dependencies.

Delivery

  1. PR 1 (M): Refs feat(release): a release is cut only after every argo cd application builds at the release head and its live changes are shown #1343. The offline gate and its call in the cut. template.py gains build_manifest_path, which builds what render_manifest_path builds without the substitution; render_manifest_path becomes that build plus the substitution. It also gains one predicate for "holds a template domain value", shared with render_manifest_template. _KUSTOMIZATION_NAMES (template.py:21) moves to constants.py, beside a new CONST_K8S_ARGOCD_APPLICATION_DIRS. Failures raise ArgoCDGateError, a KubernetesError in src/devops_cli/exceptions/k8s.py, which names every failing Application at once. Tests first:
    • In tests/test_k8s_argocd_gate.py, over fixture trees in tmp_path with the real kubectl kustomize, offline: a kustomization that lists a missing file fails, naming the Application and kustomize's message; a placeholder in a ConfigMap of devops fails; a placeholder Ingress host in a non-homelab Application fails; a placeholder in a Helm value file fails; a missing value file fails; a path holding Chart.yaml fails; a git source with another repoURL fails; a clean tree passes and names each Application it built; a tree with no k8s/argocd passes; a missing kubectl fails, naming devops install-tools --tool kubectl; a file that is in the working tree but not in the commit does not reach the build.
    • In tests/test_release.py, modelled on test_a_bad_fragment_stops_the_automatic_cut_before_it_writes_or_pushes (:2120): a gate failure stops the cut, leaving the remote refs, the local branches and the working tree unchanged and calling no gh.
    • In tests/test_k8s_argocd_apps.py, test_rendered_raw_objects_single_ownership (:217) and test_namespace_and_pvc_data_safety (:277) take their Applications from the gate's discovery instead of the lists at :219 and :278. A new test_this_repository_passes_the_argocd_gate makes devops ci run the gate on every pull request.
    • Files: src/devops_cli/k8s/argocd_gate.py, src/devops_cli/k8s/template.py, src/devops_cli/release/cut.py, src/devops_cli/exceptions/k8s.py, src/devops_cli/config/constants.py, src/devops_cli/lang/en/messages.py, the three test files, RELEASE_CYCLE.md (Step 2, :192-197), changelog.d/1343.md, and docs/agent/tasks/task-1343-*.md.
  2. PR 2 (M): closes feat(release): a release is cut only after every argo cd application builds at the release head and its live changes are shown #1343. The live report, run by the cut right after the gate. It never blocks. Tests first, in tests/test_k8s_argocd_live_report.py, with a fake runner that records argv and the environment:
    • with no argocd.url, token or binary, one warning names what is missing and the cut goes on;
    • each Application is diffed at the release tip sha with --grpc-web, a multi-source Application by its git source position, and the token appears only in the environment;
    • exit 1 is reported as "differs", exit 2 as "failed" with its stderr cut to CONST_MAX_ERROR_DETAIL_LENGTH, and neither stops the cut;
    • a placeholder host at the tip that no live test operation names is reported with its deploy-stack --stack command.
    • Files: src/devops_cli/k8s/argocd_live_report.py, src/devops_cli/argo/ (the lifted server and token resolution), src/devops_cli/commands/argo.py, src/devops_cli/release/cut.py, the new test file, RELEASE_CYCLE.md, changelog.d/1343.md (extended), and the task file.

Acceptance criteria

  • Every cut path runs the offline gate on the fetched release tip before it creates a branch, writes a file, commits, pushes or opens a pull request.
  • A failed build, an unbuildable source, a missing value file or a misplaced placeholder stops the cut with ArgoCDGateError, naming each Application and why. Origin, the local branches and the working tree stay unchanged, and no gh command runs.
  • The gate builds from git archive of the release tip, so a gitignored file in the working tree never reaches a build.
  • Applications are discovered from k8s/argocd/apps and k8s/argocd/bootstrap, and no list of Application names or paths remains in the gate or in tests/test_k8s_argocd_apps.py:217-310.
  • test_this_repository_passes_the_argocd_gate passes at the head of the release branch, in under 2 s.
  • Without kubectl the gate fails, naming devops install-tools --tool kubectl.
  • With a configured Argo CD server, the cut reports each Application's diff at the release tip, and each placeholder host that no live override covers, with its deploy-stack command. The report never stops the cut, and the token never appears in argv.
  • Without a server, a token or the argocd binary, the report is skipped with one warning.
  • RELEASE_CYCLE.md Step 2 describes the gate and the report.
  • changelog.d/1343.md records the change. CHANGELOG.md and docs/ROADMAP.md are not edited.
  • uv run devops ci passes.
  • Pending a person: at the v0.2.37 cut, with Argo CD configured, the report lists all 22 Applications, which shows that --grpc-web reaches the server through the tunnel.

Current references

  • cut_release: src/devops_cli/release/cut.py:1024; fetch, checkout, commit-and-push, PR: :1065, :1066, :1092, :1119
  • Cut callers: src/devops_cli/commands/release.py:299, :365; src/devops_cli/commands/roadmap.py:483; src/devops_cli/roadmap/run.py:519
  • render_at_revision, _host_fields, host_patches, Run: src/devops_cli/k8s/argocd_overrides.py:80, :108, :143, :29
  • render_manifest_template, _render_kustomize_dir, render_manifest_path, _KUSTOMIZATION_NAMES: src/devops_cli/k8s/template.py:59, :87, :126, :21
  • CONST_K8S_TEMPLATE_DOMAIN_PLACEHOLDER: src/devops_cli/config/constants.py:667
  • CONST_K8S_ARGOCD_HOMELAB_APPLICATIONS, ..._BY_STACK: src/devops_cli/config/constants.py:679, :681
  • KubernetesError: src/devops_cli/exceptions/k8s.py:14
  • Argo CD URL and token: src/devops_cli/commands/argo.py:162-179; REST reads: :212, :294
  • Hard-coded Application lists: tests/test_k8s_argocd_apps.py:219, :278; _all_applications: :36
  • Cut-stops-before-push test to model: tests/test_release.py:2120
  • Pinned kubectl and argocd: src/devops_cli/tools_lock/tools.lock:27-28, :127-128
  • Service image stage, without kubectl: Dockerfile:25-41

Dependencies and order


Problem

v0.2.28's release pull request (#1283) took about ten hours after it opened, because problems no check had caught were found only at the end.

Each of these can be detected without a model and without Copilot.

Acceptance criteria

  • Before the cut opens the release pull request (devops release prepare --create-pr, and the roadmap job's cut), it runs a deterministic gate:
    • every Application in k8s/argocd/apps builds with Kustomize at the release head, using its own source path;
    • no rendered host remains under the placeholder domain once the Application's live overrides are applied;
    • on an Argo CD-managed cluster, each Application's diff against the live cluster at the release head is reported, through Argo CD's API or argocd app diff --revision;
    • the service image tag the release pins either exists, or the report names the outage window until Release Orchestration publishes it.
  • A failed build or a placeholder host stops the cut, with an error naming the Application. The live diff and the image check are reported, and do not block.
  • Tests run the gate over fixture Applications offline: a build failure, a placeholder host, and a clean release.
  • changelog.d/<n>.md records the change; CHANGELOG.md and docs/ROADMAP.md are not edited.
  • uv run devops ci passes.

Key questions

  • Where does the live diff run when the roadmap job cuts in the cluster? (proposed) roadmap-service reads Argo CD's API in-cluster. A workstation cut uses the configured Argo CD context. Without either, the gate reports that the live diff was skipped.

Strategic alignment

Update 2026-10-08: refinement

#1451 makes the pinned image exist before the release merges, so the gate's image bullet is dropped. Of 20 Applications, 8 have a source path; the build covers those, and two tests list them by hand (tests/test_k8s_argocd_apps.py:211, :271).

  • The gate and both tests find path Applications by reading k8s/argocd/apps.

Activity

  1. added
    type/feature
    scope/k8s
    priority/p1-high
    scope/release
    on Oct 7, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. It prevents multi-hour release delays and potential production outages, but releases still function today, so it is important rather than urgent.
    • Effort: Medium. Requires Kustomize build orchestration, placeholder-domain detection, Argo CD API diff integration, image-tag verification, offline fixture tests, and wiring into the existing release-prepare command.
  3. added this to the v0.2.37 milestone on Oct 11, 2026
  4. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    Readiness check for v0.2.37, against release/v0.2.36 at 22d8748. Line numbers are at that commit.

    Status: needs a split, plus a reference refresh.

    Today

    • cut_release (src/devops_cli/release/cut.py:1024-1119) has no Kubernetes gate.
    • Two commands call it: devops release prepare --create-pr, and devops roadmap close --confirm (src/devops_cli/commands/roadmap.py:483).
    • No workflow runs kustomize.
    • The tests with hard-coded Application lists are now at tests/test_k8s_argocd_apps.py:219 and :278; the body cites :211 and :271.

    Facts for the design

    • k8s/argocd/apps/ has 22 Applications. 8 of them have a path: base, devops, gpu-feature-discovery, ingress, llm, logging, monitoring and otel.
    • The domain placeholder is CONST_K8S_TEMPLATE_DOMAIN_PLACEHOLDER (src/devops_cli/config/constants.py:667), and only the homelab overrides fill it (:679).
    • src/devops_cli/k8s/argocd_overrides.py already has render_at_revision (:80) and host_patches (:143) to reuse.
    • The Argo CD REST calls are in src/devops_cli/commands/argo.py:212 and :294. There is no diff helper.

    Obsolete in the body

    Questions for the owner

    • The placeholder check needs the live Application patches. When there is no cluster context, should it skip or fail?
    • For the live diff, use the Argo CD API or the argocd binary?
    • Is kubectl required wherever a cut runs?

    Proposed split

    • PR 1 (M): an offline gate in src/devops_cli/release/argocd_gate.py, called from the cut at cut.py:1068-1092 before the push.
      • Tests: a build failure, a placeholder host, a clean release, and origin left unchanged after a failure.
      • The two tests above discover the Applications instead of listing them.
    • PR 2 (M): a live diff report that does not block the cut.
  5. dan-petty commented on Oct 19, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1688, merged into release/v0.2.37 as 32e9de3.

    Description

    Part 1 of #1343: Implements a deterministic offline Argo CD application build gate invoked during release cutting.

    • Discovers all Argo CD Application resources under k8s/argocd/apps and k8s/argocd/bootstrap pointing to this repository.
    • Exports a clean snapshot of the release tip using git archive into an isolated temporary directory, ensuring uncommitted or gitignored files cannot hide broken kustomizations.
    • Builds every path application using Kustomize (build_manifest_path) and verifies template domain placeholder safety: placeholders (example.com, $DOMAIN, etc.) are permitted only in host fields of homelab applications ("devops", "ingress"), and are rejected in ConfigMaps, non-host fields, Helm value files, or non-homelab applications.
    • Fails closed with typed ArgoCDGateError before any release branching, file modifications, commits, or pushes occur in cut_release.
    • Updates RELEASE_CYCLE.md documenting the gate in Step 2 of the release procedure.
    • Includes comprehensive unit and integration tests covering valid trees, missing kustomizations, placeholder violations, foreign repoURLs, and release abort orchestration.

    Follow-up PR 2 will deliver the live Argo CD diff and override report and close #1343.

    11 file(s) changed.

    How it was verified

    Check runs at f9f20f6:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • zizmor: pass
    • devops-cli: pass
    • bandit: pass
    • CodeQL: pass
    • Changed-Test Independence: pass
    • Rule Pack Tests: pass
    • Fail-to-Pass Check: pass
    • Fail-to-Pass Self-Check: pass
    • Tests & Coverage: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • Static Analysis: pass
    • Service Image: skipping
    • Dependency Freshness: skipping
    • DevContainer Image: skipping

    Acceptance Criteria of docs/agent/tasks/task-1343-argocd-build-gate.md:

    • Every Argo CD Application pointing to this repository is discovered and validated.
    • Path applications are built using Kustomize from an exported archive of the release tip.
    • Template domain placeholder values outside allowed homelab host fields trigger gate failure.
    • Missing kustomization files, broken resources, or missing Helm value files raise ArgoCDGateError.
    • A gate failure prevents cut_release from creating branches, writing files, or pushing to origin.
    • RELEASE_CYCLE.md documents the Argo CD build gate in Step 2.
    • Unit and integration tests verify pass and failure conditions across all application permutations.
    • Live Argo CD diff and override report after the offline gate (closes feat(release): a release is cut only after every argo cd application builds at the release head and its live changes are shown #1343 in follow-up PR).
  6. added 3 commits that reference this issue on Oct 19, 2026
    a8e1a61
    954914e
    7c4f143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/k8sscope/releasetype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions