Skip to content

fix: cache registry image metadata - #13341

Merged
sipsma merged 3 commits into
mainfrom
codex/manifest-cache-regression-test
Jun 5, 2026
Merged

sipsma merged 3 commits into
mainfrom
codex/manifest-cache-regression-test

Conversation

@dagger-codex

@dagger-codex dagger-codex Bot commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Cache registry image manifest/config metadata in the engine content store after tag resolution so repeated container.from("tag") calls do not re-download the same metadata across canonical resolution, lazy pull, and later sessions.

The resolver still revalidates tag refs with registry HEAD requests. If the tag now points at a new digest, the new manifest/config metadata is fetched and stored, so this avoids repeated metadata GETs without over-caching mutable tags.

Details

Before this change, the current resolver path rebuilt short-lived containerd resolvers/fetchers for ResolveImageConfig and later pull work. Even when the tag digest had not changed, the same manifest and config could be fetched repeatedly instead of being reused from the engine-wide content store. On registries like Docker Hub, duplicate manifest GETs are the request class most likely to affect pull quotas.

This adds a metadata-only resolver path that:

  • resolves tags remotely as before, preserving freshness;
  • stores fetched manifest/config descriptors and bytes in the engine content store under a short lease;
  • attaches distribution source labels so local reuse is scoped to the registry source;
  • reuses local manifest/config metadata by digest when the tag still resolves to the same descriptor;
  • fetches metadata again when the tag resolves to a new manifest digest.

This does not reintroduce BuildKit's shared resolver/auth pool. Auth/token behavior remains per current resolver/session behavior.

Tests

  • go test ./core/integration -run '^$'
  • dagger --progress=plain call go lint --include core/integration/container_registry_cache_test.go
  • dagger --progress=plain call engine-dev test --pkg ./core/integration --run='TestContainer/TestFromTagCachesManifestMetadataAcrossSessions'

The focused integration test uses a mutable counting OCI registry. It verifies:

  • two sequential sessions against the same tag fetch manifest/config/layer data once;
  • the tag is still revalidated with HEAD;
  • after pushing a new image to the same tag, Dagger reads the updated image;
  • exactly one additional manifest/config/layer fetch occurs for the new digest.

Observed final local counts after the tag update:

{ManifestGETs:2 ManifestHEADs:5 ConfigGETs:2 LayerGETs:2}

CI test-split:test-container passes on the pushed head.

Add an integration test with a counting OCI registry that serves a small tagged image and records manifest/config fetches. The test runs two sequential sessions against one nested engine and asserts that tag revalidation uses HEADs while manifest/config metadata is downloaded only once.

Signed-off-by: Solomon Hykes <[email protected]>
@dagger-codex
dagger-codex Bot force-pushed the codex/manifest-cache-regression-test branch from ab0708e to b46c011 Compare June 5, 2026 22:07
@sipsma sipsma added this to the v0.21.5 milestone Jun 5, 2026
Store resolved image manifests and configs in the engine content store during default registry resolution. This lets canonical config resolution and later pulls reuse metadata after tag revalidation instead of issuing repeated manifest and config GETs.

Signed-off-by: Solomon Hykes <[email protected]>
@dagger-codex
dagger-codex Bot force-pushed the codex/manifest-cache-regression-test branch from b46c011 to a1c9dbe Compare June 5, 2026 22:29
@dagger-codex
dagger-codex Bot marked this pull request as ready for review June 5, 2026 23:22
@dagger-codex dagger-codex Bot changed the title test: cover registry manifest metadata reuse fix: cache registry image metadata Jun 5, 2026
@sipsma
sipsma merged commit f14ac5f into main Jun 5, 2026
76 of 77 checks passed
@sipsma
sipsma deleted the codex/manifest-cache-regression-test branch June 5, 2026 23:44
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
dagger 0.21.5

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## v0.21.5 - 2026-06-10

### Added

- Added expand option to container.exists by @alexcb in dagger/dagger#13310
- Support both Dang v1 and v2, routed by module engineVersion by @vito in dagger/dagger#13388

### Changed

- Prune local cache during disk pressure by @sipsma in dagger/dagger#13375
- Persist trivial core objects by @sipsma in dagger/dagger#13387

### Fixed

- Correct namespaced type-name mangling and cross-dependency interface dispatch in Dang by @vito in dagger/dagger#13377
- Surface exec errors correctly on the Bun runtime in the TypeScript SDK by @marcosnils in dagger/dagger#13395
- Ignore host xattrs for local filesync import identity by @sipsma in dagger/dagger#13389
- Don't shallow-clone the user's repo for git telemetry labels by @marcosnils in dagger/dagger#13363
- Preserve pending lazy container parents by @sipsma in dagger/dagger#13365
- Preserve withChanges parent layers by @dagger-codex[bot] + @shykes in dagger/dagger#13342
- Treat incomplete image metadata as cache miss by @sipsma in dagger/dagger#13346
- Cache registry image metadata by @dagger-codex[bot] + @shykes in dagger/dagger#13341
- Don't require id field for interface conformance in Dang by @vito in dagger/dagger#13318
- Use module-local check names for scale-out by @dagger-codex[bot] + @tiborvass in dagger/dagger#13329
- Fix snapshot owner lease attach/remove race by @sipsma in dagger/dagger#13321
- Follow source symlinks when copying directory contents in layercopy by @marcosnils in dagger/dagger#13326

### What to do next?

- Read the [documentation](https://docs.dagger.io)
- Join our [Discord server](https://discord.gg/dagger-io)
- Follow us on [Twitter](https://twitter.com/dagger_io)

</pre>
  <p>View the full release notes at <a href="https://github.com/dagger/dagger/releases/tag/v0.21.5">https://github.com/dagger/dagger/releases/tag/v0.21.5</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!11205
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants