-
Notifications
You must be signed in to change notification settings - Fork 83
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
Modify the ref option #169
Conversation
image/descriptor.go
Outdated
} | ||
case "digest": |
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.
Walking the index to find an entry pointing at a given digest seems odd. Doing that in findDescriptor
seems fine, but create
and unpack
seem like they could skip straight over index.json
into CAS resolution when you know the digest and media type (although you'd need to use --type
or a new option to get the media type).
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 don't think so. when you get a given digest, we also need to verify that it conforms to the specification by validateDescriptor
.
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 don't think so. when you get a given digest, we also need to verify that it conforms to the specification by
validateDescriptor
.
Sure, if you're validating a ref. But if you're just trying to unpack an image, and you have the digest and media type (from --type
), I don't see why you'd need to hit anything outside CAS.
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.
What do you think about this change.
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.
What do you think about this change.
My problem wasn't with validateDescriptor
for digest==
ref names. If we get a media type from --type
and have a digest==…
name, I think we can skip around all of this and never hit anything outside of CAS in unpack
.
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.
The type obtained by --type is only the file type of create
or unpack
( imageLayout
or image
). And the type of digest obtained here is manifest or index. We can't get the media type corresponding to digest through --type
, only through findDescriptor
to confirm the media type.
d549631
to
3cdbaa7
Compare
This PR is partly duplicated with #89 |
7d49b49
to
4aa4df9
Compare
@coolljt0725 @stevvooe PTAL |
cmd/oci-image-tool/create.go
Outdated
@@ -85,8 +85,8 @@ var createCommand = cli.Command{ | |||
}, | |||
cli.StringFlag{ | |||
Name: "ref", | |||
Value: "v1.0", | |||
Usage: "The ref pointing to the manifest of the OCI image. This must be present in the 'refs' subdirectory of the image.", | |||
Value: "org.opencontainers.image.ref.name==v1.0", |
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.
Is this the default value? Why is the default value v1.0
?
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.
Is this the default value?
Yes.
Why is the default value v1.0?
Just follow the previous default value.
reping @stevvooe @wking @coolljt0725 @cyphar @xiekeyang @vbatts I need your advices. |
Bump. |
man/oci-image-tool-create.1.md
Outdated
The ref pointing to the manifest of the OCI image. This must be present in the "refs" subdirectory of the image. (default "v1.0") | ||
Specify the search criteria, format is A==B. | ||
e.g. --ref org.opencontainers.image.ref.name==v1.0 | ||
Only support `org.opencontainers.image.ref.name`, `platform.os` and `digest` three cases.(default org.opencontainers.image.ref.name==v1.0) |
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.
use ==
seems odd to me, can we just use =
? And another question, does it support the old way --ref=latest
? or we should use org.opencontainers.image.ref.name=latest
to specify a ref ?
And if we have multiple images for a platform.os
, does all these images will be unpack?
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.
And I think in this way, we change the semantic meaning of the ref
, the ref
supposed to representing a tag of 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.
use == seems odd to me, can we just use =?
updated.
And another question, does it support the old way --ref=latest? or we should use org.opencontainers.image.ref.name=latest to specify a ref ?
use org.opencontainers.image.ref.name=lates
And if we have multiple images for a platform.os, does all these images will be unpack?
Yes, all images conforming to the platform. OS will be unpack.
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.
Yes, all images conforming to the platform. OS will be unpack.
Is that a desired behavior ? Will these images be unpack to different rootfs
?
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 maybe something is not clear:
unpack at a time can only be an image
or imageLayout
unpack. When ref
point to the index
, then go to the platform.os
to filter manifest, and then according to the manifests to unpack to the rootfs
, I think your question is not that if the match of the manifest there are many, should not unpack to the same rootfs
?
If this is the problem, I do not know is not able to unpack to the same file, if not, it should increase the screening of the manifests to determine.
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.
There could be multiple images with different ref for a specific platform in an image
or imageLayer
, My question is if platform.os=xx
match multiple image, when you do unpack
or create bundle
, Will these images will be unpacked to same rootfs
? That's not a desired behavior.
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.
Sorry. I did not understand it before.
My question is if platform.os=xx match multiple image, when you do unpack or create bundle, Will these images will be unpacked to same rootfs?
No. If platform.os=xx match multiple image, The program will be error.
74f5081
to
263330a
Compare
I just think |
263330a
to
f758639
Compare
@coolljt0725 updated. Thanks for your advices. |
with this patch when I validated a image, the output is
I think it's a bit of redundant and make user confuse, and I use
So the |
ping @opencontainers/image-tools-maintainers |
9198a55
to
752e33a
Compare
@opencontainers/image-tools-maintainers @vbatts @coolljt0725 @stevvooe @Mashimiao Find reference more accurately through multiple ref inputs The following is the specific operation results:
|
2a9a780
to
612d162
Compare
d = index.Manifests[i] | ||
return errEOW | ||
descs = index.Manifests | ||
for _, name := range names { |
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.
The following code is totally duplicate with part code of validate() in image/image.go
Maybe we can create a common or utility function by taking advantage of it.
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.
updated, PTAL.
612d162
to
60a93f0
Compare
ping @opencontainers/image-tools-maintainers PTAL. This is a change on UI, I think it needs more lgtm |
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
43a1e42
to
c3ac69c
Compare
It would be good to summarize the change. Does this now allow one to ignore parts of the layout by specifying a ref? What is the use for only validating one part of an image? Is there an updated proposal? |
I don't quite understand what you mean. What does
For the image validation process, I just continued the previous practice: Verify the specified manifest according to the ref. In my opinion, this patch is no problem and can be merged. |
This patch dragged for a long time, I will merge it first, what problems can be amended later. |
@q384566678 Did this patch have the requisite LGTMs from maintainers to proceed? Questions in #169 (comment) were not resolved. |
According to the latest rules, a LGTM can merge patches. This patch waits for a long time, and no one else to review, so I can only merge it first.
As for the question you said, I have already given a reply below because I did not understand something you said and you did not reply to me. I think if there are other problems can be repaired in the next pr. Please forgive me if there is anything wrong with it. |
I reviewed it and asked for a summary of the changes: "It would be good to summarize the change." Just because it takes a long time doesn't mean it is okay to merge. I have no clue what is wrong with this because there is no proposal describing the end result of what this PR is attempting to accomplish. |
The purpose of this pr is to solve the problem that the |
Increase the search conditions, you can better retrieve descriptor.
Resolved when the search is not unique or non-existent.
cc/ @opencontainers/image-tools-maintainers
Fixes #164
Signed-off-by: zhouhao zhouhao@cn.fujitsu.com