ko-build / ko

Build and deploy Go applications
https://ko.build
Apache License 2.0
7.55k stars 396 forks source link

multi-platform build - unable to calculate manifest: set of images is empty #995

Closed mbrancato closed 1 year ago

mbrancato commented 1 year ago

When attempting to save a multi-platform build as a tar file, ko fails to produce it and returns the following:

% ko build --platform linux/amd64,linux/arm64 --push=false --tarball "/tmp/test.tar" ./cmd/myapp 
2023/03/20 17:19:04 Using base cgr.dev/chainguard/static:latest@sha256:d214cea83716044267b2805096b9a7e67fa05a9c385804ff728b51b0f98ae18f for cmd/myapp
2023/03/20 17:19:04 Building cmd/myapp for linux/arm64
2023/03/20 17:19:04 Building cmd/myapp for linux/amd64
2023/03/20 17:19:07 Saving /tmp/test.tar
2023/03/20 17:19:07 failed to save "/tmp/test.tar": unable to calculate manifest: set of images is empty
Error: failed to publish images: error publishing ko://cmd/myapp: failed to interpret cmd/myapp result as image: &{0xc0001bb480 <nil> <nil> 0xc0002eace0 map[sbom:0xc0002eacc0]}

Builds for the individual platforms work fine.

jonjohnsonjr commented 1 year ago

I don't believe we can produce a multi-platform image in a tar file. I believe using --oci-layout-path should work.

mbrancato commented 1 year ago

@jonjohnsonjr ahh, interesting. If I publish a multi-platform build locally, it appears to only get the local platform build. Doing something like docker save only exports the local platform version.

I use a multi-step process to build and publish. The first step builds and saves an artifact, and the second step loads that artifact, and publishes. That was previously done using tar. Is there a way to load and publish an oci layout using ko or other ideas to publish all platforms after re-loading the previous oci image layout?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Keep fresh with the 'lifecycle/frozen' label.