-
Notifications
You must be signed in to change notification settings - Fork 2.6k
add podman artifact extract #25238
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
add podman artifact extract #25238
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99 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 |
Ephemeral COPR build failed. @containers/packit-build please check. |
must be used to select only a single blob. If the file already exists it will be | ||
overwritten. | ||
|
||
If the target is an directory (it must exist) all blobs will be copied to the |
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.
If the target is an directory (it must exist) all blobs will be copied to the | |
If the target is an directory (it must exist), all blobs will be copied to the |
overwritten. | ||
|
||
If the target is an directory (it must exist) all blobs will be copied to the | ||
target directory. As target file name the value from `org.opencontainers.image.title` |
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.
Seems like a typo here maybe ... did you mean "a" or "the" target file ?
|
||
If the target is an directory (it must exist) all blobs will be copied to the | ||
target directory. As target file name the value from `org.opencontainers.image.title` | ||
annotation is used. If the annotation is missing the target file name will be |
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.
annotation is used. If the annotation is missing the target file name will be | |
annotation is used. If the annotation is missing, the target file name will be |
target directory. As target file name the value from `org.opencontainers.image.title` | ||
annotation is used. If the annotation is missing the target file name will be | ||
the digest of the blob (with `:` replaced by `-` in the name). | ||
If the target file already exists in the directory it will be overwritten. |
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.
If the target file already exists in the directory it will be overwritten. | |
If the target file already exists in the directory, it will be overwritten. |
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 fairly brief skim; ACK overall, some more design questions.
Note the
title string | ||
) | ||
for _, l := range arty.Manifest.Layers { | ||
if options.Digest == l.Digest.String() { |
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.
Non-blocking: This probably can be structured as if layerMatchesOptions(…) {
duplicate check; set digest
/title
}
). This works fine as is, and it is short enough that it is not that necessary.
} | ||
defer dest.Close() | ||
|
||
// TODO use reflink is possible |
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 a long term todo, or something you would do as part of this PR?
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 is easy to do, but as usual I don't want to duplicate code and the c/image function is internal so I have to export it first then vendor again, etc... So not something I plan to do for this PR but I will be working on that soon enough.
3bde1e7
to
73f058f
Compare
I pushed 4 small artifacts for testing
I leave the PR as draft for now and work to get them into our VM images to avoid flakes. |
73f058f
to
ed5bb02
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.
I have only a few minor comments, mostly LGTM
stat, err := os.Stat(target) | ||
if err == nil { |
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.
stat, err := os.Stat(target) | |
if err == nil { | |
if stat, err := os.Stat(target); err == nil { |
err = copyImageBlobToFile(ctx, imgSrc, l.Digest, filepath.Join(target, filename)) | ||
if err != nil { |
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.
err = copyImageBlobToFile(ctx, imgSrc, l.Digest, filepath.Join(target, filename)) | |
if err != nil { | |
if err := copyImageBlobToFile(ctx, imgSrc, l.Digest, filepath.Join(target, filename)); err != nil { |
err := registry.ImageEngine().ArtifactExtract(registry.Context(), args[0], args[1], &extractOpts) | ||
if err != nil { |
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.
err := registry.ImageEngine().ArtifactExtract(registry.Context(), args[0], args[1], &extractOpts) | |
if err != nil { | |
if err := registry.ImageEngine().ArtifactExtract(registry.Context(), args[0], args[1], &extractOpts); err != nil { |
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.
LGTM
This is needed by containers/podman#25238 To avoid flakes we need to have the test artifacts in the cache registry. Signed-off-by: Paul Holzinger <[email protected]>
Add a new command to extract the blob content of the artifact store to a local path. Fixes https://issues.redhat.com/browse/RUN-2445 Signed-off-by: Paul Holzinger <[email protected]>
ed5bb02
to
3925a30
Compare
This is good to go, rebased on main with the image update to include the artifacts so we shoul dnot get any new pull flakes from it. |
/lgtm |
Add a new command to extract the blob content of the artifact store to a local path.
Fixes https://issues.redhat.com/browse/RUN-2445
Does this PR introduce a user-facing change?