Skip to content

feat(k8s): Argo CD follows release tags #1862

Closed as not planned
Closed as not planned

Description

@dan-petty

Friction

All 28 git sources of the Argo CD applications track main. They sit in 27 files under k8s/argocd. bootstrap.yaml and cluster.yaml are among them.

Under the old pipeline, main changed only when a release merged. So the cluster changed only at a release. After the old pipeline ends, topic pull requests merge to main at any time. An application that tracks main then builds a manifest change before the image for it exists (#1451).

The property "the cluster follows releases" must come from the applications. Argo CD can track the highest semver tag. The release workflow creates the tag as its last write, after the images exist. So the manifests move after the image.

The constraint has a floor and no ceiling. It keeps working after 0.3.0 and after 1.0.0. Nothing in it assumes a version series.

Evidence

The counts below come from commit f3b17488, the tip of release/v0.2.39, on 2026-10-22.

  • git grep -n "targetRevision: main" -- k8s prints 28 lines in 27 files. The 25 files under k8s/argocd/apps hold 26 lines, because argocd.yaml holds two git sources. The two parents hold the other two lines.
  • The 15 chart sources keep their pinned versions, for example targetRevision: 10.9.6 in argocd.yaml.
  • The remote has 44 tags, and all are vN.N.N. One clone also holds the tags backup/wave1-684, backup/wave1-692 and backup/wave1-693. Argo CD skips such tags.
  • Argo CD resolves a constraint in MaxVersion in util/versions/tags.go. It uses github.com/Masterminds/semver/v3. The library accepts the v prefix, and the function skips tags that are not valid semver. This comes from the upstream source, read on 2026-10-22. Nobody ran it on a cluster.
  • The floor >=0.2.0 marks no change in the manifests. Tags v0.1.8 and v0.2.0 hold 3 files under k8s/argocd. Tag v0.2.27 holds 26. Argo CD takes the highest tag in range, so the floor never selects a tag.
  • There is no upper bound, so 0.3.0 and 1.0.0 resolve. After the flip, a tag that matches the constraint deploys. The tag ruleset of ADR 0012 (step 7) limits who can create one.
  • tests/test_k8s_argocd_apps.py asserts main in _check_app_git_sources (lines 146-149 and 155-158). It also asserts main in the expected sources at lines 796 and 816.
  • application_source (lines 42-59 of src/devops_cli/k8s/argocd_overrides.py) reads targetRevision as text. render_at_revision (lines 80-105) passes that text to git fetch. A constraint is not a git ref, so the fetch fails.
  • Only the Applications devops and ingress take that path (CONST_K8S_ARGOCD_HOMELAB_APPLICATIONS).
  • Image Updater does not change. k8s/argocd/image-updater-values.yaml keeps the digest of service:latest. That digest moves only at publish. So the image and the manifests follow two independent pins, and a rollback is two actions.
  • k8s/README.md still says that the Applications track main (lines 511, 512 and 536). It says that cluster tracks a release branch (line 754). Line 536 also names release/vX.Y.Z.

The parents bootstrap and cluster read their own definitions from the revision that they track. If a person sets them to the constraint before a tag contains the constraint text, they resolve to a tag whose definition says main. They then flip between the two on every refresh. This follows from the semantics of Argo CD. Nobody observed it.

So the parents stay on main with sync policy none until a release publishes a tag that contains the constraint. The child definitions in the cluster do not update in that time. The children keep tracking main.

devops argo cd apps bootstrap-gitops applies the local k8s/argocd/bootstrap/bootstrap.yaml (src/devops_cli/commands/argo.py:327-401). From a checkout that holds this item, it applies the constraint to bootstrap. So nobody runs it from such a checkout before the flip.

Existing tool considered

  • Used: the semver targetRevision constraint of Argo CD. Nothing is built for tag resolution, and the repository gets no version logic.
  • Used: the revision that Argo CD reports. The upstream comment on status.sync.revision says it is "the revision the comparison has been performed to". deploy-stack reads it. It does not resolve tags with git ls-remote and a semver parser of its own.
  • Not used: a commit for each release that rewrites targetRevision. The old pipeline did this until refactor(release): the release no longer pins, bumps or pre-publishes the service image tag; image updater rolls service:latest #1486 removed it. It needs a writer and a commit for every release.
  • Not used now: the semver update strategy of Image Updater. It applies to images. The image keeps following the digest of service:latest. ADR 0012 lists it as a revisit condition.
  • Written cost of the build: the only code is the revision read in application_source and its tests. ADR 0012 gives no figure for this step. This item carries the estimate before work starts. The estimate has the tokens to implement, maintain and fix, and the elapsed time. Until then, the build is a proposal.

Proposed remedy

  1. Set targetRevision: ">=0.2.0" on the 28 git sources. Quote the value, because > starts a YAML block scalar. Write no upper bound. Chart sources keep their pins.

  2. In src/devops_cli/k8s/argocd_overrides.py, make application_source take the revision from status.sync.revision when the Application has it. When the status is empty, it keeps targetRevision. No list of patterns decides whether targetRevision is a constraint. --argocd-revision still overrides the result.

  3. In k8s/README.md, change the text for the new tracking. Change these lines:

    • Lines 511 and 512 (the parents). Say that they track main until a person flips them to the constraint (ADR 0012, step 13).
    • Line 528 (what deploy-stack fetches).
    • Lines 534-537 (the heading and items 1 and 2).
    • Lines 753-754 (the tree comments).

    Item 1 shows how to stage hosts before a tag exists. For example, --argocd-revision main stages the manifests of the next tag. The release pull request changes no file under k8s/.

  4. In src/devops_cli/lang/en/help.py (lines 358-361), reword the help of --argocd-revision. It no longer says "before a release merges". Then run devops docs generate --sync-readme. This updates docs/CLI_REFERENCE.md and docs/MCP_TOOLS.md.

The pull request for this item follows these rules:

  • The base is main. The title is feat(k8s): Argo CD follows release tags. The title is the changelog entry of the first release.
  • The body says Closes #1862. It has no Part of line and no changelog fragment, because nothing collects a fragment after v0.2.39.
  • While the task-file rule is in force, devops pr check-readiness asks for docs/agent/tasks/task-1862-<slug>.md. The task file shows the completed work.

Items 3 and 4 of the README section "When a release merges into main" (lines 538 and 539) describe release.yml. The item "docs(workflow): the instructions describe trunk, derived versions and the release pull request" rewrites them. It also rewrites line 403, which is the ruleset bypass of the machine account.

The cluster change is person-run and ordered:

  • Pending a person: before this item merges, set the sync policy of bootstrap and cluster to none. The new definitions then do not reach the cluster. Every application keeps tracking main.
  • Pending a person: merge no manifest change under k8s/ until a release holds the constraint.
  • Pending a person: instead of the previous step, set each application by hand after you read argocd app diff. Use argocd app set <app> --revision ">=0.2.0". This resolves to v0.2.39, the last release of the old pipeline. Its content equals main until then.
  • Pending a person: after the first release publishes a tag that contains the constraint, flip bootstrap and cluster to the constraint. Steps D4 and D5 of chore(settings): the release App, the release environment, the squash settings and the required checks are in place #1864 give the commands and the checks.

If the constraint resolves an unexpected tag, a person pins the application to a tag by hand. ADR 0012 then asks for a new look at the semver strategy of Image Updater.

What it deletes

  • The assumption that the revision of an Application is a git ref and is read as text. It leaves application_source.
  • The main literal on 28 lines of YAML, and in 4 places of tests/test_k8s_argocd_apps.py (lines 146-149, 155-158, 796 and 816).
  • The statements in k8s/README.md that name main or a release branch as the tracked revision (lines 511, 512, 536, 753 and 754).

The item deletes no file and no function.

Tests

  • tests/test_k8s_argocd_apps.py: _check_app_git_sources asserts that every git source of this repository carries exactly ">=0.2.0". The exact string means that no upper bound exists. The _all_applications() helper includes bootstrap and cluster, so the test covers both parents. The existing chart check keeps the pinned versions.
  • tests/test_k8s_argocd_overrides.py: application_source returns status.sync.revision for an Application JSON with a constraint and a status. It returns targetRevision when the status is empty. render_at_revision renders the manifests at a full commit SHA of the local repository from the _repo helper.
  • tests/test_k8s.py: the _Cluster fake answers kubectl get application. For one test, it returns a constraint and a status revision. A deploy-stack run then derives the hosts from the status revision. A second case shows that --argocd-revision still wins.
  • devops docs check and uv run devops ci pass.

Order and dependencies

Acceptance criteria

  • git grep -n "targetRevision: main" -- k8s prints nothing. All 28 git sources carry ">=0.2.0". None has an upper bound. Chart sources keep their pins.
  • tests/test_k8s_argocd_apps.py asserts the exact string >=0.2.0 for each git source of this repository, bootstrap and cluster included. The test fails for a source that carries main or an upper bound.
  • A test in tests/test_k8s_argocd_overrides.py shows that application_source returns status.sync.revision when it exists and targetRevision when it does not.
  • A test shows that render_at_revision renders the manifests at a full commit SHA.
  • A deploy-stack test with the _Cluster fake in tests/test_k8s.py shows two facts. The hosts of a constraint come from the status revision. --argocd-revision wins.
  • No code uses a list of strings or patterns to decide whether targetRevision is a constraint.
  • git grep -nE "Tracks .main|track .main|tracking main|tracking release branch|release/vX\.Y\.Z" -- k8s/README.md prints no line other than line 403.
  • The help of --argocd-revision no longer says "before a release merges". docs/CLI_REFERENCE.md and docs/MCP_TOOLS.md match it, and devops docs check passes.
  • Before this merges, a throwaway Application with targetRevision: ">=0.2.0" against this repository, in a scratch namespace, resolves to v0.2.39. argocd app get shows that tag. kubectl get application <name> -o jsonpath='{.status.sync.revision}' prints a commit SHA and not the constraint text. The pull request body records both outputs. The throwaway is deleted.
  • The pull request targets main and says Closes #1862. It has no Part of line and no changelog fragment.
  • The estimate of the build is in the "Existing tool considered" section before work starts.
  • uv run devops ci passes with at least 90 percent coverage.

The "Pending a person" bullets in the section "Proposed remedy" are not checks of the pull request.

Activity

  1. added
    source/agent
    type/feature
    on Oct 22, 2026
  2. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    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.

    • Type: type/feature. The candidate proposes a new feature to make Argo CD follow release tags instead of the main branch.
    • Priority: P2-Medium. This change affects how the cluster tracks releases and requires careful coordination during the transition, but it's not critical for immediate operation.
    • Value: High. Improves release consistency and reliability by aligning cluster state with official releases.
    • Effort: High. Involves updating multiple files, tests, documentation, and requires a coordinated cluster update process.
  3. dan-petty commented on Oct 23, 2026

    @dan-petty
    OwnerAuthor

    Not planned: the owner decided on 2026-10-23 that Argo CD keeps tracking main (ADR 0013).

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

    source/agenttype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions