Skip to content

fix(k8s): the image-pins dry run names each planned fetch #7372

Done

Description

@dan-petty

Problem

devops k8s image-pins --dry-run does not print the git fetch of a source of another repository. SourceTrees records the fetch commands of a dry run (_fetch in src/devops_cli/k8s/app_sources.py), and collect_image_pins puts them in ImagePins.planned. k8s_image_pins in src/devops_cli/commands/k8s/image_pins.py never reads planned. The dry run prints each chart command, because run_subprocess prints each command that it plans. ARCHITECTURE.md, section 7.1, says that a dry run prints the requests that a real run sends.

Evidence

  • A tree with one path Application whose repoURL is https://github.com/example/product at main, and one chart Application: uv run devops k8s image-pins --k8s-dir <tree>/k8s --dry-run prints Would run command: helm template ... and no line with fetch. The run was on main at 57f0116e3 with the change of feat(k8s): render an OCI chart in image-pins #7368.
  • git grep -n planned -- src/devops_cli/commands/k8s/image_pins.py gives no line. deploy-stack prints its fetches from trees.planned (src/devops_cli/commands/k8s/stack_lifecycle.py:1767).

Acceptance criteria

  • The dry run of devops k8s image-pins prints each fetch command that a run starts for a source of another repository.
  • A dry run still makes no request and starts no program.

Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches for dry-run printing of planned subprocess and git fetch commands returned only unrelated MDN pages. The need is a small change inside the project's own command: print ImagePins.planned, so no external tool covers it.

Lacks:

  • Dry run never reads ImagePins.planned, so no fetch line prints
  • Each fetch of a source of another repository stays hidden
  • No shared helper prints planned commands outside run_subprocess

Proposed design

Problem statement

devops k8s image-pins --dry-run prints no git fetch line for a source of another repository. SourceTrees records the fetch commands and collect_image_pins puts them in ImagePins.planned, but the command never reads that field. ARCHITECTURE.md section 7.1 says that a dry run prints each request that a real run sends. A person cannot see which repositories a real run fetches.

Acceptance criteria

Requirement: The dry run prints each planned fetch

The dry run of devops k8s image-pins SHALL print each git fetch command that a real run starts for a source of another repository.

Scenario: One source of another repository

  • WHEN The test runs devops k8s image-pins --k8s-dir <tree>/k8s --dry-run on a tree whose one Application names https://github.com/example/product at main.
  • THEN The output holds one line that names git, fetch and https://github.com/example/product.

Requirement: The dry run starts no fetch and no render

A dry run SHALL start no fetch, no render and no registry read, and send no request.

Scenario: No external command runs

  • WHEN The test doubles run_subprocess in devops_cli.k8s.app_sources and devops_cli.k8s.image_pins, and runs the dry run on the same tree.
  • THEN The double records no call whose arguments hold fetch, helm or kustomize, and the output still holds the planned fetch line.

Requirement: No fetch line without another repository

The dry run SHALL print no fetch line when each source of the tree is the origin.

Scenario: A tree with no source of another repository

  • WHEN The test runs the dry run on a tree whose Applications name only the origin.
  • THEN The output holds no line with fetch.

Existing Tool Considered

The alternatives check in the issue body gives the verdict none and names no tool, so no open tool or library covers this need. The issue body holds the check, its searches and its reason; this proposal adds no tool and restates no part of the check. The change prints ImagePins.planned in the project's own command. Written cost to build it instead: about 3,000 tokens to build, about 1,000 tokens to keep and fix, and about 20 minutes elapsed, for one print loop and one message key.

Key questions

  • Where does the dry run print the planned fetch commands?: In k8s_image_pins, from pins.planned, before the dry-run info line. The library returns the commands and the command prints them, as deploy-stack prints trees.planned. (best practice) [sources: src/devops_cli/commands/k8s/image_pins.py, src/devops_cli/commands/k8s/stack_lifecycle.py:1767, ARCHITECTURE.md]
    • Chosen: Print in the command from pins.planned. The command layer prints and the library returns data. deploy-stack prints its planned fetches the same way.
    • Rejected: Print inside collect_image_pins. The library would print, and research/render.py calls it too.
    • Rejected: Print inside _fetch in dry-run mode. deploy-stack already prints trees.planned, so its output would hold each fetch twice.
  • Which text does the dry run print for one fetch command?: One info line for each command, with the words of the command joined by spaces. The line uses the message that run_subprocess prints for a planned command, so each dry run reads the same. (best practice) [sources: src/devops_cli/core/process.py, src/devops_cli/commands/k8s/image_pins.py]
    • Chosen: Reuse the planned-command message of run_subprocess. One wording for each dry run, and no second prefix string to keep in step.
    • Rejected: Add a new message with its own wording. Two wordings for one idea, and a reader sees two formats.
  • Does ImagePins already carry the planned fetch commands?: Yes. SourceTrees.planned collects the commands of a dry run and collect_image_pins puts them in ImagePins.planned. The command does not read the field. [sources: src/devops_cli/k8s/app_sources.py, src/devops_cli/k8s/image_pins.py, src/devops_cli/commands/k8s/image_pins.py]
  • Does a dry run of devops k8s image-pins start a program today?: Yes, one local read: repository_origin runs git config --get remote.origin.url with local_read=True. The dry run starts no fetch and no render, and sends no request. The change keeps that local read. [sources: src/devops_cli/k8s/app_sources.py]
  • Which tests cover the command and its dry run?: tests/k8s/test_image_pins.py covers collect_image_pins. tests/commands/test_k8s_dry_run.py covers the dry run of the k8s commands. The change adds a case to each file. [sources: tests/k8s/test_image_pins.py, tests/commands/test_k8s_dry_run.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor
  2. added
    type/bug
    scope/k8s
    source/agent
    status/new
    value/medium
    effort/low
    priority/p2-medium
    on Nov 27, 2026
  3. 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 (3)

    Searches run:

    • python dry-run print planned subprocess commands without executing, results: 5
    • git fetch dry run print commands without making a request, results: 5
    • plumbum dry run echo shell commands instead of running library, results: 5

    Sources:

  4. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  5. 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.

  6. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 28, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  8. 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