buildpacks / imgutil

Helpful utilities for working with images
Apache License 2.0
23 stars 41 forks source link

Use daemon or runtime provided arch instead of amd64 #232

Closed jericop closed 9 months ago

jericop commented 9 months ago

The current defaultPlatform functions sets the architecture to "amd64", which causes pack to use the amd64 build image, and to install the amd64 lifecycle, when creating a new builder from an arm64 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 the arm64 as expected. https://github.com/jericop/github-actions/blob/main/buildpacks/create-multi-arch-builders/standalone/imgutil-pr-232-verify-amd64-issue.sh.log#L159

The 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

jjbustamante commented 9 months ago

Summary

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

Local change

Remote change