Repository navigation
Description
Problem or Motivation
devops k8s image-pins (#1994) resolves each image pin with docker buildx imagetools inspect, which reads the manifest with a GET. Docker Hub counts that read as an anonymous pull of the caller's public address.
Measured on 2026-10-29 with buildx v0.38.1 and an empty Docker configuration: three inspects took Docker Hub's ratelimit-remaining from 100 to 97 (ratelimit-limit: 100;w=3600). 13 of the 31 pins under k8s/ are on Docker Hub, so each run spends 13 pulls. On the home network the cluster's nodes share that allowance: the measurements of #1994 spent it to 0, and a run then failed with toomanyrequests on portkeyai/gateway:1.15.0. On a GitHub runner, the address is shared with other tenants.
Proposed Solution & Architectural Design
- Resolve each pin with a HEAD request of the manifest, which Docker Hub does not count ("HEAD requests aren't counted", Docker Hub usage and limits).
crane digest <image>(go-containerregistry) sends a HEAD and falls back to a GET only when the HEAD fails. - Pin
craneinsrc/devops_cli/tools_lock/tools.lock(go-containerregistry v0.22.1: the release assets carry adigest, andchecksums.txtlists the same sha256 for the Linux and Darwin tarballs), install it in theimage-pinsjob withuv run devops install-tools --tool crane --only-missing, and record its runs for the fake that replacesImagetoolsFake. - Measure first that
crane digestleavesratelimit-remainingunchanged for an anonymous client.
Target Subsystem
src/devops_cli/k8s/image_pins.py, tools.lock, the image-pins job of ci.yml, the image resolver's fake and recording.
Existing Tool Considered
crane (go-containerregistry, Apache-2.0, maintained by Google). regctl image digest and oras manifest fetch --descriptor also send a HEAD. skopeo inspect and docker manifest inspect read the manifest with a GET, as imagetools does. The change deletes the imagetools resolver and its record.
Acceptance criteria
- An anonymous
crane digestof three Docker Hub images leavesratelimit-remainingunchanged (measured and recorded in the proposal). devops k8s image-pinsresolves withcrane digest, and the contract suite holds the record to the command and to the lock's version.- The
image-pinsjob installs the pinned crane.
Proposed design
Problem statement
devops k8s image-pins resolves each image pin with a GET request. Docker Hub counts that read as an anonymous pull. Thirteen of the 31 pins are on Docker Hub. Each run spends 13 pulls from the shared allowance. The cluster's nodes share that allowance. A run can fail with toomanyrequests.
Acceptance criteria
Requirement: HEAD resolution
devops k8s image-pins SHALL resolve each pinned image with a HEAD request of the manifest via tag_digest, not a GET.
Scenario: Anonymous HEAD to Docker Hub
- WHEN An anonymous client resolves a Docker Hub image pin through tag_digest
- THEN ratelimit-remaining is unchanged after the resolution
Requirement: No new binary pin
The image-pins CI job SHALL NOT require a new tool pin in tools.lock for image resolution.
Scenario: CI job resolves without crane
- WHEN The image-pins job runs on a pull request that changes k8s/
- THEN The job resolves images using tag_digest with no crane or buildx binary
Requirement: Remove imagetools fake
The ImagetoolsFake, its contract suite, and its recordings SHALL be removed from the codebase.
Scenario: ImagetoolsFake is absent
- WHEN The codebase is searched for ImagetoolsFake
- THEN No file references ImagetoolsFake
Requirement: HTTP edge tests
Tests of image pin resolution SHALL double the registry at the HTTP edge, not at the process level.
Scenario: Registry double at HTTP edge
- WHEN A test resolves an image pin
- THEN The registry is replaced by an HTTP-level double
Requirement: No local reference split
k8s/image_pins.py SHALL NOT contain its own reference split function.
Scenario: image_reference is absent
- WHEN The codebase is searched for image_reference in k8s/image_pins.py
- THEN The function is not present in that file
Existing Tool Considered
No alternatives check has run. The project's own tag_digest in src/devops_cli/docker/registry.py (added in #1997) covers the need. It sends a HEAD request of the manifest and handles the 401 Bearer token challenge. No new binary pin is needed. The code is already built, tested, and used by devops argo cd apps status.
Key questions
- Which resolver should devops k8s image-pins use?: tag_digest from src/devops_cli/docker/registry.py, which sends a HEAD request and handles the 401 Bearer token challenge. No new binary pin is needed. (best practice) [sources: openspec/changes/archive/2026-10-29-1997-argo-image-pin-drift/design.md]
- Chosen: tag_digest (project code). Already in src, tested, used by devops argo cd apps status. No new binary pin, fake, or contract suite needed.
- Rejected: crane (go-containerregistry). Needs a new pin in tools.lock, a new fake, and a new contract suite. Duplicates what tag_digest already does.
- Rejected: docker buildx imagetools inspect (current). Uses a GET request, which Docker Hub counts as an anonymous pull. This is the defect being fixed.
- Does tag_digest handle Docker Hub's 401 challenge?: Yes. When the registry answers 401, it gets an anonymous Bearer token from the realm of the challenge and sends the HEAD again. [sources: openspec/changes/archive/2026-10-29-1997-argo-image-pin-drift/design.md]
- What happens to the ImagetoolsFake and its contract suite?: They are removed. The resolver no longer calls a subprocess. Tests double the registry at the HTTP edge. (best practice) [sources: src/devops_cli/k8s/image_pins.py]
- Chosen: Remove ImagetoolsFake and contract suite. The resolver uses tag_digest over HTTP, not a subprocess. A process-level fake is no longer needed.
- Rejected: Keep ImagetoolsFake. Would require a new fake for tag_digest's HTTP calls, which is more complex than an HTTP-level double.
- Does k8s/image_pins.py keep its own reference split?: No. One split stays in docker/registry.py. k8s/image_pins.py keeps no reference split of its own. (best practice) [sources: src/devops_cli/k8s/image_pins.py]
- Chosen: Remove image_reference from k8s/image_pins.py. The split stays in docker/registry.py, avoiding duplication of the reference grammar.
- Rejected: Keep image_reference in k8s/image_pins.py. Duplicates the split logic that already exists in docker/registry.py.
- Does the CI job need a new tool pin for image resolution?: No. tag_digest is in src, so no new entry in tools.lock is needed. The image-pins job needs no crane and no buildx for resolution. (best practice) [sources: src/devops_cli/tools_lock/tools.lock]
- Chosen: No new pin. tag_digest is in src. No binary is needed for image resolution.
- Rejected: Pin crane in tools.lock. Adds a new binary, a new fake, and a new contract suite for what tag_digest already does.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The title prefix perf maps to type/infra.It causes intermittent CI failures from shared rate-limit exhaustion but the feature still works most of the time.It prevents shared rate-limit exhaustion that blocks other tenants and CI runs on the same address.It requires pinning crane, changing the resolver, updating the CI job, and updating test fakes and recordings.Both work on the image-pins resolver under k8s/, but #1994 adds the check while the candidate replaces its GET-based resolver with a HEAD-based one to avoid rate-limit consumption.test(k8s): each image pin under k8s/ resolves before the merge (#2614)
dan-petty commentedon Oct 29, 2026
A HEAD resolver is already in
src, so this item needs no new binary.devops_cli.docker.registry.tag_digest(#1997, PR #2605, merged before #2614) reads the digest of a tag with a HEAD request of the manifest. When the registry answers 401, it gets an anonymous Bearer token from the realm of the challenge and sends the HEAD again.devops argo cd apps statususes it throughdevops_cli.argo.image_pins.check_pins.Proposed scope instead of
crane:devops k8s image-pinsresolves each pin withtag_digestthrough the shared HTTP client. Theimage-pinsjob then needs nocraneand nobuildx, andtools.lockgets no new entry.tagged_imageaccepts the forms thatk8s/image_pins.pyreads now: a name with no registry (Docker Hub: API hostregistry-1.docker.io, and thelibrary/prefix for a one-component name) and a reference with a digest.k8s/image_pins.pykeeps no reference split of its own (image_reference). One split stays, indocker/registry.py, and build(deps): Type docker-py with types-docker #2603 moves it to docker-py's parser.Check first: an anonymous HEAD from
tag_digestto a Docker Hub manifest leavesratelimit-remainingunchanged. The token request toauth.docker.iois not a pull.devops-cli-service commentedon Oct 30, 2026
Status set to Ready at 07fb4c2 (see proposed design in issue body).
devops-cli-service commentedon Nov 1, 2026
Staged: branch
perf/2610-devops-k8s-image-pins-resolves-with, draft pull request #3096. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
docs(openspec): fix plan #2610 host map, digest refs, dry run
8 remaining items
feat(roadmap): let the step guard allow a recorded test removal (#3715)
[-]perf(k8s): devops k8s image-pins resolves with a HEAD request that Docker Hub does not count[/-][+]perf(k8s): use tag_digest HEAD for image pins[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 81 characters, and the limit is 60. The type and the scope stay.
perf(k8s): devops k8s image-pins resolves with a HEAD request that Docker Hub does not countperf(k8s): use tag_digest HEAD for image pinsfix(openspec): accept every Verification line of an active plan (#3809)
docs(openspec): update plan #2610 for typed docker-py
docs(openspec): tick the fail-to-pass task of #2610
docs(openspec): archive the change of #2610
devops-cli-service commentedon Nov 6, 2026
Released in v0.73.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.73.0
devops-cli-service commentedon Nov 6, 2026
Live since 2026-11-06 22:09 UTC