-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Drop name argument from Load API #8112
Drop name argument from Load API #8112
Conversation
1523cff
to
c2480c2
Compare
LGTM |
c2480c2
to
f008f36
Compare
/lgtm |
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.
I want a head nod from @mtrmac on it. The code is tricky and my eyes are tired :)
|
||
## DESCRIPTION | ||
**podman load** loads an image from either an **oci-archive** or a **docker-archive** stored on the local machine into container storage. **podman load** reads from stdin by default or a file if the **input** option is set. | ||
You can also specify a name for the image if the archive does not contain a named reference, of if you want an additional name for the local image. |
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.
I think we should keep that but document which formats support it.
libpod/runtime_img.go
Outdated
if !strings.Contains(name, "/") { | ||
return layout.NewReference(inputFile, fmt.Sprintf("%s/%s", image.DefaultLocalRegistry, name)) | ||
if name != "" { | ||
return nil, errors.Errorf("oci format does not support additional name %s", name) |
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.
That seems unrelated. Why's that needed?
/hold |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: QiWang19, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
A quick impression is that this makes sense, still I’d like this PR to go further:
-
More extensive refactoring: AFAICS the
name
parameter is now only used for a comparison with""
(and an error message that is probably now very misleading and should be updated). So, should the callers be passing it in at all? Thename
parameter either shouldn’t exist, or it should exist and be used, or it should be replaced by a boolean (or possibly by splitting this function into two,LoadImageFromSingleImageArchive
vs.LoadAllImageFromArchive
, or whatever is best for the callers). And so on all the way up the call stack, including possibly dropping the parameter from the API. -
Documentation: While this probably resolves the ambiguity in actual behavior, will it be clear to future readers, and API users? What are we doing here, what does the
name
field mean after all? (Its mere presence seems to have a non-obvious effect fordocker-archive
; and in the other formats we just don’t allow it instead of having a similar non-obvious effect. Is that right?) fix podman load oci-archive's tar with name #7386 (review) is not quite the level of detail needed here because the code does make more sense, but still broadly those categories of things would be nice to record for posterity somewhere — at least for the API it should be clearly documented what the name/tag parameters mean. (Or if the parameters are removed, there will be nothing left to document, sure.)
To make sure it is not forgotten, #7386 (review) says this should be dropped in Podman 3.0. Is this the right time/branch?
libpod/runtime_img.go
Outdated
if !strings.Contains(name, "/") { | ||
return ociarchive.NewReference(inputFile, fmt.Sprintf("%s/%s", image.DefaultLocalRegistry, name)) | ||
if name != "" { | ||
return nil, errors.Errorf("oci format does not support additional name %s", name) |
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.
BTW this will never be seen by users, the way err
is currently maintained by the loop. So the UI might need a bit more thought (or perhaps just give up and return nil, nil
here — probably not, but that does depend on what the refactoring in callers ends up doing).
This branch is not meant to drop it. This patch wants to keep the support for docker-archives but removes the description from the document before Podman 3.0. |
Ah, right, that comment was about removing the “tag the result with $this name” parameter, while this removes the “load $this image from an OCI archive” functionality. Still, is that OK to do before 3.0? Or was it completely broken already? |
f008f36
to
d895f61
Compare
d895f61
to
56a5f86
Compare
56a5f86
to
0df78a7
Compare
@mtrmac PTAL |
@mtrmac PTAL |
@containers/podman-maintainers PTAL |
LGTM, but this is API Breakage so it has to wait til we branche for 3.0. |
@QiWang19 Please rebase and we can merge. |
Not pass the name argument to Load API. Specify in the document the usage of the optional argument is tagging an additional image. Close containers#7337 Signed-off-by: Qi Wang <[email protected]>
0df78a7
to
f525d8b
Compare
@containers/podman-maintainers PTAL |
/lgtm |
/hold cancel |
Looks like containers#7337 was fixed (by containers#8112). Reenable a disabled test for it; and make it actually work. Confirmed that newly-added test fails on d456765 (the commit before containers#8112). Signed-off-by: Ed Santiago <[email protected]>
Drop the name argument to Load API. Splitting the code for load single and multiple images into two functions, LoadImageFromSingleImageArchive LoadAllImageFromArchive
Specify in the document the usage of the optional name argument of the
podman load
is tagging an additional image.Close #7337
Signed-off-by: Qi Wang [email protected]