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
Bug 1919032: Fix image extract from Root Directory #713
Bug 1919032: Fix image extract from Root Directory #713
Conversation
@zerodayz: This pull request references Bugzilla bug 1919032, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
dc08ed8
to
32a29cb
Compare
/test e2e-agnostic-cmd |
/assign @sallyom |
/bugzilla refresh |
@soltysh: This pull request references Bugzilla bug 1919032, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
the problem is that when only file is being a source for example /help.1, the directory "parent" is "." and it was excluded because of the name == "." || parent == ".". Even fixing this was not enough since tar doesn't consider /. meaning the root directory is omited, for example: Hence adding new functions. I am unsure about the case/switch that can be further improved. Any feedback welcome @sallyom Let me know. |
I see this PR fixes the bug, great!! Sharing to enable easy verifying: $ touch hello
$ container=$(buildah from alpine)
$ buildah copy $container hello /hello
$ buildah commit --format docker $container localhost:5000/alpine:new
$ podman push localhost:5000/alpine:new
$ mkdir ext; cd ext
$ oc image extract localhost:5000/alpine:new --file /hello
$ ls
hello
$ rm hello && oc image extract localhost:5000/alpine:new --path /hello:/tmp/ext
$ ls
hello and for non root-dir extract: $ touch hello-hello
$ container=$(buildah from alpine)
$ buildah copy $container hello /tmp/hello-hello
$ buildah commit --format docker $container localhost:5000/alpine:new-new
$ podman push localhost:5000/alpine:new-new
$ mkdir ext; cd ext
$ oc image extract localhost:5000/alpine:new --file /tmp/hello-hello
$ ls
hello-hello |
32a29cb
to
03aff15
Compare
/retest |
1 similar comment
/retest |
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.
/approve
@sallyom owns the final tag
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.
@zerodayz I made a note in the file to fix the Alter fn. Also, you'll need to run
make update-gofmt
(or gofmt -w -s pkg/cli/image/extract/extract.go
) Then all looking good, thank you!
Closes: BZ#1919032
03aff15
to
73cdcd3
Compare
/retest |
/retest |
/test e2e-agnostic-cmd |
1 similar comment
/test e2e-agnostic-cmd |
This test should be fixed now |
/test e2e-agnostic-cmd |
/cc @sallyom All tests are passing, would you be able to review again? Thanks! |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sallyom, soltysh, zerodayz 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 |
@zerodayz: All pull requests linked via external trackers have merged: Bugzilla bug 1919032 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Changes like these need unit tests. I’d like to see a set added that verify the streamed function receives the correct files from a set of generated fake images before we allow more changes like this to these commands. |
@zerodayz can you prepare tests ensuring this is working as designed in a followup? |
@soltysh @smarterclayton Will work on unit tests today. My bad apologies. |
@soltysh @smarterclayton @sallyom I started putting together Unit tests for It seems that there are no unit tests at all for |
This patch adds possibility to extract file from the root directory of an image.
Closes: BZ#1919032