Skip to content

fix: fetch registry buildpacks per platform when building to the daemon - #2728

Open
herder wants to merge 2 commits into
buildpacks:mainfrom
herder:fix/buildpack-fetch-per-platform
Open

herder wants to merge 2 commits into
buildpacks:mainfrom
herder:fix/buildpack-fetch-per-platform

Conversation

@herder

@herder herder commented Oct 27, 2026 •

Copy link
Copy Markdown

Summary

When building to a daemon that uses the containerd image store, pack fetches buildpackages from project.toml or a registry without a platform. The daemon can hold several variants of a multi-platform buildpackage, so the inspect either:

  • finds no labels and fails the build, or
  • picks the host's variant, putting another architecture's buildpack into the image.

This change makes extractPackaged use FetchForPlatform in daemon mode, as the builder (#2589) and lifecycle (#2467) fetches already do. Targets without an architecture, such as pack buildpack package with {OS: linux}, keep the plain Fetch, because digest resolution needs an exact OS/architecture match. If the digest can't be resolved, for example for a package built locally and never pushed, it falls back to Fetch, which uses the daemon's copy as before. Remote fetches are unchanged; they already select the platform via WithDefaultPlatform.

Output

The repro from #2726: pack build --platform linux/arm64 without --publish on an amd64 host, with Docker 29 and the containerd image store.

Before

  • Only the arm64 variant cached: could not find label 'io.buildpacks.buildpackage.metadata'
  • The amd64 variant also cached: the build succeeds, but runs the amd64 buildpack (tiny-health-checker-x86_64-…), and /layers/paketo-buildpacks_health-checker/thc/thc is x86-64.

After

  • Both cases build. The buildpack downloads tiny-health-checker-aarch64-…, and thc is ARM aarch64.
  • A native build without --platform still uses the x86_64 binary.

Documentation

  • Should this change be documented?
    • Yes, see #___
    • No

Related

Resolves #2726

@herder
herder requested review from a team as code owners October 27, 2026 07:17
@github-actions github-actions Bot added this to the 0.41.0 milestone Oct 27, 2026
@github-actions github-actions Bot added the type/enhancement Issue that requests a new feature or improvement. label Oct 27, 2026
@herder

herder commented Oct 27, 2026

Copy link
Copy Markdown
Author

The build / test (linux) check seems to be failing on other prs as well: #2727

@herder

herder commented Nov 2, 2026

Copy link
Copy Markdown
Author

Depends on #2730

@jjbustamante jjbustamante added type/bug Issue that reports an unexpected behaviour. and removed type/enhancement Issue that requests a new feature or improvement. labels Nov 15, 2026
A daemon with the containerd image store can hold several variants of a
multi-platform buildpackage. Inspecting it without a platform either finds
no labels, failing the build, or picks the host's variant, putting another
architecture's buildpack into the image. Resolve the target's digest first,
as the builder and lifecycle fetches already do (buildpacks#2589, buildpacks#2467).

Targets without an architecture keep the plain fetch: digest resolution
needs an exact OS/architecture match.

Signed-off-by: Niklas Herder <niklas.herder@gmail.com>
A package built locally and never pushed has no registry digest for
FetchForPlatform to resolve. Fetch already tolerates that and uses the
daemon's copy, so fall back to it.

Signed-off-by: Niklas Herder <niklas.herder@gmail.com>
@herder
herder force-pushed the fix/buildpack-fetch-per-platform branch from 0e6b029 to 030ad89 Compare November 16, 2026 14:48
@github-actions github-actions Bot added the type/enhancement Issue that requests a new feature or improvement. label Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/bug Issue that reports an unexpected behaviour. type/enhancement Issue that requests a new feature or improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daemon builds with --platform extract project.toml buildpacks for the host architecture

2 participants