Closed jericop closed 9 months ago
This PR is fixing an issue when running pack using emulation with docker buildx
which I think it is great!!
Additionally, I think the root problem is that we can't define the platform when creating Builders, something we are trying to solve with the multi-arch RFC but improving the default values to be more realistic than hard coding something, I think is a great improvement
OSType
: type of the operating system of the host, as returned by the Go runtime (GOOS). Currently returned values are "linux" and "windows", and hard coding amd64
Os
The operating system that the daemon is running on ("linux" or "windows")Arch
The architecture that the daemon is running on
This makes a lot of sense to me, because with the local interface we are going to look for images in the daemon. We are changing the hard coded amd64
for runtime.GOARCH
which is defined as: is the running program's architecture target: one of 386, amd64, arm, s390x, and so on.
This also makes sense to me, because when we are running pack commands, we expect to match the host machine
The current
defaultPlatform
functions sets the architecture to "amd64", which causes pack to use theamd64
build image, and to install theamd64
lifecycle, when creating a new builder from anarm64
host with no docker daemon installed.This changes the default platform functions to use the docker daemon os and architecture for local images, and
runtime.GOARCH
as the architecture for new remote images.The following log file is the output of a script that was used to identify the issue. https://github.com/jericop/github-actions/blob/main/buildpacks/create-multi-arch-builders/standalone/imgutil-pr-232-verify-amd64-issue.sh.log
You can see that the script doesn't finish. You can also see that it downloads an
amd64
lifecycle rather than thearm64
as expected. https://github.com/jericop/github-actions/blob/main/buildpacks/create-multi-arch-builders/standalone/imgutil-pr-232-verify-amd64-issue.sh.log#L159The following log file is the output of a script was used to identify that an updated version of pack that uses this fix. https://github.com/jericop/github-actions/blob/main/buildpacks/create-multi-arch-builders/standalone/imgutil-pr-232-verify-fix.sh.log