Skip to content

perf(k8s): use tag_digest HEAD for image pins - #3843

Merged
dan-petty merged 4 commits into
mainfrom
perf/2610-tag-digest-head-pins
Nov 6, 2026
Merged

dan-petty merged 4 commits into
mainfrom
perf/2610-tag-digest-head-pins

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

devops k8s image-pins now calls tag_digest, which sends a HEAD request of the manifest. Before, it ran docker buildx imagetools inspect, which reads the manifest with a GET. Docker Hub counts a GET as an anonymous pull and does not count a HEAD request. image_reference moves to the registry module and splits with docker-py. The imagetools fake, its recording and its contract suite go.

Closes #2610

Change: openspec/changes/archive/2026-11-06-2610-devops-k8s-image-pins-resolves-with/

@dan-petty dan-petty added type/infra Type infra: the build, CI, images or cluster scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 6, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test evidence for this pull request.

  • Rebase base: origin/main 26a0ef4 (no conflicts).
  • Targeted tests after the rebase: tests/docker/test_registry_tag_digest.py, tests/k8s/test_image_pins.py, tests/invariants/test_workflow_contracts.py: 181 passed.
  • uv run devops ci fail-to-pass --base origin/main: 8 tests failed on base, 136 passed on base, 1 errored on base. The 8 new or changed tests fail without the change and pass with it.
  • git diff --exit-code origin/main -- src/devops_cli/tools_lock/tools.lock: no change. The image-pins job needs no new tool pin.
  • Pre-push fast static checks: passed.

Pull request #3822 typed docker-py, so the plan builds image_reference on the docker-py parser and adds no digest field. The recheck of the premise is in the proposal.
devops k8s image-pins resolved each pin with docker buildx imagetools inspect, which reads the manifest with a GET. Docker Hub counts that read as an anonymous pull, so each run spent one pull for each Docker Hub pin.

The command now calls tag_digest, which sends a HEAD request of the manifest. Docker Hub does not count a HEAD request. tagged_image reads a Docker Hub name and a reference with a tag and a digest, and tag_digest sends a Docker Hub name to registry-1.docker.io. image_reference moves to the registry module and splits with docker-py, so the hand-written copy of the reference grammar goes. ImagetoolsFake, its recording and its contract suite go, and the tests double the registry at the HTTP edge. The image-pins job needs no new tool pin.
@dan-petty
dan-petty force-pushed the perf/2610-tag-digest-head-pins branch from e6a0508 to 0543213 Compare November 6, 2026 20:09
@dan-petty

Copy link
Copy Markdown
Owner Author

Update after the first CI run.

  • The check Image Pins failed: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.20.0 answers a manifest request with HTTP 307 to us-west2-docker.pkg.dev. imagetools followed the redirect; the HTTP client of the command did not.
  • Cause fixed in src/devops_cli/commands/k8s/image_pins.py: the client is built with follow_redirects=True. With it, tag_digest gives sha256:42cfe372... for that image on the real registry.
  • New test test_the_command_follows_the_redirect_of_a_registry_to_its_storage fails without the fix (exit 1) and passes with it.
  • Branch rebased onto origin/main bc5f241. Targeted tests: 182 passed. The fix is in the commit of the change, and the archive commit is still last.

@dan-petty
dan-petty marked this pull request as ready for review November 6, 2026 20:15
@dan-petty
dan-petty merged commit a61d671 into main Nov 6, 2026
24 checks passed
@dan-petty
dan-petty deleted the perf/2610-tag-digest-head-pins branch November 6, 2026 20:16
dan-petty pushed a commit that referenced this pull request Nov 6, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.73.0](v0.72.1...v0.73.0)
(2026-11-06)


### Features

* **pr:** check-readiness blocks a body that breaks the form
([#3849](#3849))
([6c973a5](6c973a5)),
closes [#3259](#3259)
* **roadmap:** Allow read pipes to a table of allowed programs
([#3838](#3838))
([89daf41](89daf41)),
closes [#3520](#3520)
* **roadmap:** size the runner Job resources from the plan
([#3848](#3848))
([32328b1](32328b1))


### Bug Fixes

* **ai:** fix MCP ai_benchmark models description
([#3840](#3840))
([26a0ef4](26a0ef4))
* **review:** catch findings.json validation errors
([#3841](#3841))
([bc5f241](bc5f241))
* **security:** Refuse Go, Yarn and uv env keys
([#3845](#3845))
([235a807](235a807))


### Performance Improvements

* **k8s:** use tag_digest HEAD for image pins
([#3843](#3843))
([a61d671](a61d671))


### Code Refactoring

* **roadmap:** the in-memory store leaves src
([#3839](#3839))
([558c5e0](558c5e0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/infra Type infra: the build, CI, images or cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(k8s): use tag_digest HEAD for image pins

1 participant