-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support building from a scratch image #1038
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might have a better time using pkg/v1/empty
and pkg/v1/mutate
to do this:
idx := mutate.IndexMediaType(empty.Index, types.OCIImageIndex)
for _, p := range platforms {
plat, err := v1.ParsePlatform(p)
// handle err
img := mutate.MediaType(
mutate.ConfigMediaType(empty.Image, types.OCIConfigJSON),
types.OCIManifestSchema1,
)
idx = mutate.AppendManifests(idx, mutate.IndexAddendum{
Add: img,
Descriptor: v1.Descriptor{
Platform: plat,
},
})
}
return idx, nil
This will handle most of the manual hash handling for you, and should be usable has a multi-arch zero-layer base image.
I wonder what we should do when the base is scratch
and --platform=all
🤔
6f32b9f
to
543c80d
Compare
"all" failed to parse with the previous platform parsing code, I added an explicit error for it now. I concluded it didn't make sense for a scratch image case, and you can work around it by just providing all platforms if you really do want them. |
543c80d
to
5239c55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good! Thanks for doing this.
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #1038 +/- ##
==========================================
+ Coverage 52.82% 52.89% +0.07%
==========================================
Files 43 44 +1
Lines 3360 3399 +39
==========================================
+ Hits 1775 1798 +23
- Misses 1359 1371 +12
- Partials 226 230 +4
|
cbbda39
to
d9566fd
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #1038 +/- ##
==========================================
+ Coverage 52.82% 53.19% +0.36%
==========================================
Files 43 44 +1
Lines 3360 3401 +41
==========================================
+ Hits 1775 1809 +34
- Misses 1359 1362 +3
- Partials 226 230 +4
|
@imjasonh Was there something else remaining for this? |
d9566fd
to
c3ab49c
Compare
c3ab49c
to
12e1fbe
Compare
Sorry for taking so long to get back to this. This change still looks good, and thanks for adding a docs section as well. I think it would be good to have an e2e test in https://github.com/ko-build/ko/blob/main/.github/workflows/e2e.yaml that does Thanks again for making this change, and sorry again for the delay. |
I'd be happy for you to take over the e2e test part. I'm swamped with some other work and certain that you can do it faster than me 😆 |
This Pull Request is stale because it has been open for 90 days with |
Can this be re-opened? I think it was only closed because it was stale, not because nobody wants it. |
Dunno what your current situation is @imjasonh maybe you can do the e2e stuff if you have time now? |
Fixes #207