Skip to content

mutate: let Time and Canonical take tarball.LayerOption - #2403

Merged
Subserial merged 1 commit into
google:mainfrom
mzihlmann:mutate-layer-options
Aug 11, 2026
Merged

Subserial merged 1 commit into
google:mainfrom
mzihlmann:mutate-layer-options

Conversation

@mzihlmann

@mzihlmann mzihlmann commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Time rebuilds the image onto empty.Image and re-tars every layer, so every layer gets compressed again. layerTime always gzips and calls tarball.LayerFromOpener with no options, so a rebuilt layer is always a types.DockerLayer. An OCI image comes back as docker schema2 and a zstd layer is silently downgraded to gzip. Canonical inherits both.

This threads tarball.LayerOption through to LayerFromOpener and hands the opener the uncompressed tar instead of pre-gzipping it. The layer is then compressed once, in the codec the caller asked for. Pair it with the existing mutate.MediaType and mutate.ConfigMediaType to bring the manifest and config along.

The options are variadic so existing call sites are unaffected, and with none passed the output is byte identical to before. I checked that across docker and oci, gzip and zstd, uncompressed, foreign and multi layer images. One incompatibility remains, Time and Canonical can no longer be assigned to a func(v1.Image) (v1.Image, error) variable.

@google-cla

google-cla Bot commented Aug 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.42%. Comparing base (7b32099) to head (67a976b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2403   +/-   ##
=======================================
  Coverage   57.42%   57.42%           
=======================================
  Files         166      166           
  Lines       11558    11558           
=======================================
  Hits         6637     6637           
  Misses       4142     4142           
  Partials      779      779           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Subserial
Subserial merged commit d3bca10 into google:main Aug 11, 2026
19 checks passed
Subserial pushed a commit to Subserial/go-containerregistry that referenced this pull request Aug 18, 2026
Subserial pushed a commit to Subserial/go-containerregistry that referenced this pull request Aug 18, 2026
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
crane 0.22.0

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>## What's Changed
* mutate: let Time and Canonical take tarball.LayerOption by @mzihlmann in google/go-containerregistry#2403
* build: add multi-architecture Cloud Build configurations for crane, gcrane, and krane by @tprussak in google/go-containerregistry#2412
* remote: resolve push-check credentials against the repository by @mzihlmann in google/go-containerregistry#2411
* Allow single-character repository paths by @semx in google/go-containerregistry#2407
* fix: add missing substitutions and workspace cleanup to new build files by @tprussak in google/go-containerregistry#2413
* remote: retry failed Puller and Pusher initialization by @iahsanGill in google/go-containerregistry#2406
* build(deps): bump the actions group across 1 directory with 8 updates by @dependabot[bot] in google/go-containerregistry#2405
* build(deps): bump the go-deps group across 1 directory with 3 updates by @dependabot[bot] in google/go-containerregistry#2415
* go.mod: bump Go version + add toolchain directive to replace .go-version file by @Subserial in google/go-containerregistry#2416
* fix: Fix new build options and provenance by @tprussak in google/go-containerregistry#2417
* fix(build): unify new build flow into cloudbuild_v2.yaml by @tprussak in google/go-containerregistry#2419

## New Contributors
* @mzihlmann made their first contribution in google/go-containerregistry#2403
* @tprussak made their first contribution in google/go-containerregistry#2412
* @semx made their first contribution in google/go-containerregistry#2407

**Full Changelog**: https://github.com/google/go-containerregistry/compare/v0.21.9...v0.21.10</pre>
  <p>View the full release notes at <a href="https://github.com/google/go-containerregistry/releases/tag/v0.22.0">https://github.com/google/go-containerregistry/releases/tag/v0.22.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!17674
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.

3 participants