Skip to content

fix(k8s): the catalog dry run names the render command of the run #7371

Done

Description

@dan-petty

Problem

devops k8s catalog --dry-run prints a helm template line for each chart source, and that line is not the command of the run. _render_dry_run in src/devops_cli/commands/k8s/catalog.py writes the line itself: helm template <application> <chart> --repo <repoURL> --version <version>. The run renders each Application with application_renders of src/devops_cli/k8s/image_pins.py. That function starts helm template <release> <chart> --repo <repoURL> --version <version> --namespace <namespace> --skip-tests --values <file>.

So the plan has no namespace, no --skip-tests and no value file, and it names the Application where the run names the releaseName. For a chart of an OCI registry (#7368), the run starts helm template <release> oci://<repoURL>/<chart>. The plan still prints --repo <repoURL>, which Helm refuses.

Evidence

  • _render_dry_run (src/devops_cli/commands/k8s/catalog.py:30) builds the argv of the plan from collect_catalog_charts.
  • _render_app_objects (src/devops_cli/k8s/catalog.py:687) renders with application_renders, and _chart_command of src/devops_cli/k8s/image_pins.py builds the command of the run.
  • Helm v4.3.2: helm template arc gha-runner-scale-set-controller --repo oci://ghcr.io/actions/actions-runner-controller-charts --version 0.15.1 exits 1 with "is not a valid chart repository or cannot be reached".

Acceptance criteria

  • The dry-run plan of devops k8s catalog names, for each chart source, the command that the run starts: the same release name, chart reference, version, namespace, --skip-tests and value files.
  • One function builds the command for the plan and for the run.
  • A dry run still makes no request and starts no program.

Source

Source: #7368

Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches found only general Helm clients such as pyhelm3, which run the helm binary against a cluster; none builds a catalog plan from Argo Applications, so the fix stays in the project's own code.

Lacks:

  • One builder shared by the plan and the run
  • OCI chart references without a --repo flag
  • Release name, namespace, skip-tests and value files in the plan
  • A dry run that starts no program and makes no request

Proposed design

Problem statement

devops k8s catalog --dry-run prints a helm template line for each chart source, and that line is not the command of the run. The line has no namespace, no --skip-tests and no value file, it names the Application where the run names the release name, and it passes --repo for a chart of an OCI registry. The fix makes one function build the command for the plan and for the run.

Acceptance criteria

Requirement: Plan names the run command

The catalog dry run SHALL print, for each chart source, the helm template command that the run starts.

Scenario: A chart source of an HTTP chart repository

  • WHEN A test runs the catalog dry run on an Application with the chart source repoURL: https://example.com/charts, chart: app, targetRevision: 1.2.3, helm.releaseName: demo-release, helm.valueFiles: [values.yaml] and destination namespace demo.
  • THEN The printed argv is helm template demo-release app --repo https://example.com/charts --version 1.2.3 --namespace demo --skip-tests --values <path of values.yaml>.

Requirement: Plan names an OCI chart by its reference

The catalog dry run MUST name a chart of an OCI registry by the reference oci://<repoURL>/<chart> and MUST NOT pass --repo.

Scenario: A chart source of an OCI registry

  • WHEN A test runs the catalog dry run on an Application whose chart source has repoURL: ghcr.io/example/charts and no scheme.
  • THEN The printed argv holds oci://ghcr.io/example/charts/app and no --repo word.

Requirement: One builder for the plan and the run

One function SHALL build the helm template command for the plan and for the run.

Scenario: The plan command equals the run command

  • WHEN A test compares the argv that the catalog dry run prints with the command that application_renders yields for the same chart source in a dry run.
  • THEN The two argvs are equal.

Requirement: The dry run starts nothing

The catalog dry run SHALL start no program and SHALL make no request.

Scenario: No subprocess call

  • WHEN A test runs the catalog dry run with run_subprocess replaced by a double that records each call.
  • THEN The double records no call and the command exits 0.

Existing Tool Considered

The alternatives check in the issue body records the verdict none of 2026-11-27, with no tool: the searches found only general Helm clients such as pyhelm3, which run the helm binary against a cluster, and none builds a catalog plan from Argo CD Applications. The block lists what the project needs and lacks. The change stays in the project's own code, and its cost is small: chart_command already builds the run command, so the change adds one field and edits one caller, about 8k tokens and about one hour to build, keep and fix.

Key questions

  • Which function builds the helm template command of a chart source?: _chart_command at src/devops_cli/k8s/image_pins.py:260 builds it, and application_renders yields it with each rendered chart. _render_dry_run builds its own argv today, so the change makes that one builder the source of both commands. [sources: src/devops_cli/k8s/image_pins.py:260, src/devops_cli/k8s/image_pins.py:302, src/devops_cli/commands/k8s/catalog.py:30]
  • How does the plan read the command of each chart source without a render?: The plan reads the chart commands from a dry run of collect_image_pins, which calls application_renders. The ImagePins value gains the field chart_commands, which holds only the helm template commands of chart sources. (best practice) [sources: src/devops_cli/k8s/image_pins.py:302, src/devops_cli/k8s/image_pins.py:337, src/devops_cli/commands/k8s/catalog.py:30, openspec/specs/k8s-service-catalog/spec.md:10]
    • Chosen: Reuse the planned chart commands of collect_image_pins. The function that the run calls builds each command, and a dry run starts no program.
    • Rejected: Add a second builder to _render_dry_run. Two builders drift again, and that drift is the defect of this issue.
    • Rejected: Run helm template in the dry run. A dry run must start no program and make no request.
  • Does a dry run of collect_image_pins start a program or make a request?: No. _render_chart returns an empty text when run_subprocess gives a PlannedProcessResult, and _require_images skips its count in a dry run. collect_image_pins resolves no image, because resolution is a separate function. [sources: src/devops_cli/k8s/image_pins.py, openspec/specs/k8s-image-pins/spec.md]
  • How does the plan tell a chart command from the other planned commands?: collect_image_pins merges the fetch commands of SourceTrees into planned, so the plan cannot tell a helm template command from a fetch. A new field chart_commands holds only the chart commands. (best practice) [sources: src/devops_cli/k8s/image_pins.py:302, src/devops_cli/k8s/image_pins.py]
    • Chosen: Add chart_commands to ImagePins. The plan reads exactly the chart commands, and no filter guesses the class of a command.
    • Rejected: Filter planned by the first word helm. A filter guesses the class of each planned command and breaks on a new planned step.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    scope/k8s
    source/agent
    status/new
    value/medium
    effort/low
    on Nov 27, 2026
  2. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 27, 2026
  4. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (9)

    Tools considered:

    Searches run:

    • python library build helm template command arguments chart oci repo, results: 5
    • helm template python wrapper library render chart release namespace values, results: 5
    • pyhelm3 python helm template, results: 5
    • "helm template" "--skip-tests" python subprocess command builder, results: 5
    • helm chart render dry run plan matches actual command library, results: 5
    • pypi pyhelm3 package, results: 5
    • helm-python github chart repository template command wrapper, results: 5
    • pyhelm3, results: 1
    • helm template oci chart reference --repo invalid chart repository, results: 5

    Sources:

  5. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  6. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 28, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  9. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 00:41 UTC

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

    effort/lowpriority/p2-mediumscope/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions