c8d: Add platform parameter to history, save and load#48295
c8d: Add platform parameter to history, save and load#48295thaJeztah merged 3 commits intomoby:masterfrom
platform parameter to history, save and load#48295Conversation
|
Unrelated failure, looks flaky, but haven't seen that one yet. |
7ae06b0 to
4d31b8c
Compare
f145088 to
aba3908
Compare
aba3908 to
3275617
Compare
3d5c3ef to
e5c6cb0
Compare
033d0f0 to
d0b8814
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
Did a pass, but happy to hear your thoughts on some of them.
|
|
||
| p, err := json.Marshal(*opts.Platform) | ||
| if err != nil { | ||
| return image.LoadResponse{}, err |
There was a problem hiding this comment.
Should we return a errdefs error here? Also probably would be good to wrap the error as we did for the other one (invalid platform:)
There was a problem hiding this comment.
Not sure - other usages of json's Marshal/Unmarshal/NewDecoder/NewDecoder in client package also return the raw error directly and don't wrap it in any way so I went with the same approach.
There was a problem hiding this comment.
Yeah, we could probably make a pass at typing those errors.
As to the wrapping; it was because I noticed that for ImageHistory we add a prefix;
return nil, fmt.Errorf("invalid platform: %v", err)Without that, the error may not give a clue where the problem is (just a plain JSON marshal error).
|
|
||
| p, err := json.Marshal(*opts.Platform) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("invalid platform: %v", err) |
There was a problem hiding this comment.
Same here for considering to use an errdefs.
☝️ Actually starting to wonder if it would make sense to have a utility for this; yes, it would be minimal (just json marshalling and handling errors), but would help producing the right errors and being consistent WDYT?
☝️ And I just realise we have httputils.DecodePlatform, so to some extent it would be nice if we had the reverse to that, but I guess httputils is part of api/server, so if we do, we should look where a suitable location would be if we want to put them together 🤔
There was a problem hiding this comment.
same here for errdefs 😄
daemon/images/image_exporter.go
Outdated
| if platform != nil { | ||
| return errdefs.NotImplemented(errors.New("platform parameter is not supported with the graphdriver image store")) | ||
| } |
There was a problem hiding this comment.
Same here
☝️ ❓ wondering now - could we somehow actually implement this? i.e. if a platform is provided and it matches then proceed - if it doesn't matches, then produce the same error as we do if we have multi-arch support (containerd image store) enabled?
There was a problem hiding this comment.
Hmm actually we can. Updated.
laurazard
left a comment
There was a problem hiding this comment.
LGTM (left a couple nits, and +1 on @thaJeztah's comments)
d0b8814 to
c25d20b
Compare
| lss layer.Store | ||
| rs refstore.Store | ||
| loggerImgEvent LogImageEvent | ||
| platform *platforms.Platform |
There was a problem hiding this comment.
Not sure platform is needed here since we have the matcher.
There was a problem hiding this comment.
It's used in error message:
Line 171 in c25d20b
There was a problem hiding this comment.
Yeah, would be great if matchers would expose more information about what they're matching and/or perhaps return an error instead of only have a boolean.
319064b to
ead3ee3
Compare
2709581 to
0d1cff7
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
some minor comments for consideration
|
|
||
| p, err := json.Marshal(*opts.Platform) | ||
| if err != nil { | ||
| return image.LoadResponse{}, err |
There was a problem hiding this comment.
Yeah, we could probably make a pass at typing those errors.
As to the wrapping; it was because I noticed that for ImageHistory we add a prefix;
return nil, fmt.Errorf("invalid platform: %v", err)Without that, the error may not give a clue where the problem is (just a plain JSON marshal error).
image/tarexport/save.go
Outdated
| "github.com/containerd/platforms" | ||
|
|
||
| "github.com/containerd/containerd/images" |
There was a problem hiding this comment.
Ugh, thanks! I really need to sort out my Goland settings 🙈
| lss layer.Store | ||
| rs refstore.Store | ||
| loggerImgEvent LogImageEvent | ||
| platform *platforms.Platform |
There was a problem hiding this comment.
Yeah, would be great if matchers would expose more information about what they're matching and/or perhaps return an error instead of only have a boolean.
Add `Platform` parameter that allows to select a specific platform to show the history for. This is a breaking change to the Go client as it changes the signature of `ImageHistory`. Signed-off-by: Paweł Gronowski <[email protected]>
Add `Platform` parameter that allows to select a specific platform to save/load. This is a breaking change to the Go client as it changes the signatures of `ImageLoad` and `ImageSave`. Signed-off-by: Paweł Gronowski <[email protected]>
Allows load to filter image manifests to load based on their platform. For save, verify that the image platform matches the requested platform, otherwise error out. Signed-off-by: Paweł Gronowski <[email protected]>
0d1cff7 to
521fa83
Compare
- What I did
Add the ability to select a specific platform for
docker history,docker saveanddocker load.- How I did it
See commits.
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)