Bug 1906277 - `oc image append` can't use --dir or --from-dir to specify the directory on disk [NEEDINFO]
Summary: `oc image append` can't use --dir or --from-dir to specify the directory on disk
Keywords:
Status: CLOSED DUPLICATE of bug 1904006
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.7
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: 4.8.0
Assignee: Sally
QA Contact: zhou ying
URL:
Whiteboard: non-multi-arch
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-10 06:09 UTC by zhou ying
Modified: 2021-02-10 21:39 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-10 21:34:30 UTC
Target Upstream Version:
Embargoed:
mfojtik: needinfo?


Attachments (Terms of Use)

Description zhou ying 2020-12-10 06:09:23 UTC
Description of problem:
`oc image append` can't use --dir or --from-dir to specify the directory on disk

Version-Release number of selected component (if applicable):
[root@preserver-workloadrhel-1 1204]# oc version 
Client Version: 4.7.0-202012091125.p0-0229219

How reproducible:
Always

Steps to Reproduce:
1) use command as follow:
`oc image append --from-dir=/home/1204/ file://myrepository/must-gather:latest --filter-by-os='linux/ppc64le' --to privateregistry:5000/openshifttest/must-gatherppc64le:latest /root/oc.tar.gz`

Actual results:
1) Failed with error: 
error: invalid argument: stat file://myrepository/must-gather:latest: no such file or directory

Expected results:
1) No error, and could copy image from local directory 

Additional info:

Comment 1 Michal Fojtik 2021-01-09 06:38:44 UTC
This bug hasn't had any activity in the last 30 days. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're marking this bug as "LifecycleStale" and decreasing the severity/priority. If you have further information on the current state of the bug, please update it, otherwise this bug can be closed in about 7 days. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. Additionally, you can add LifecycleFrozen into Keywords if you think this bug should never be marked as stale. Please consult with bug assignee before you do that.

Comment 2 zhou ying 2021-01-11 01:14:43 UTC
Just remove the LifecycleStale

Comment 3 Sally 2021-01-14 15:03:57 UTC
I'm looking into this in the upcoming sprint.

Comment 4 Sally 2021-02-05 05:27:13 UTC
I believe the flags `--to-dir` and `--dir` are confusing and lack examples in `oc image append` help menu. In the least, we need better documentation/help explaining these flags.
I do see the following works:

$ oc image mirror localhost:5000/must-gather:local file://sallyom/must-gather:latest

This creates a $(pwd)/v2/sallyom/must-gather path, so then this --from-dir flag does succeed with append:

$ oc image append --from-dir $(pwd)/v2 --to localhost:5000/must-gather:append --image '{"Entrypoint":null}' 

I'll be looking more into this this sprint.

Comment 5 Sally 2021-02-05 21:40:12 UTC
I've opened this PR to resolve: https://github.com/openshift/oc/pull/729
The PR removes the confusing '--dir' flag from append and exposes the '--to-dir' flag, while offering examples for use of both
'--to-dir' and '--from-dir' with 'oc image append'

Comment 6 Maciej Szulik 2021-02-08 12:23:51 UTC
Pushing this over to 4.8 since 4.7 is closed.

Comment 7 Sally 2021-02-10 20:49:37 UTC
Edit to above Comment 5, The PR does not remove the `--dir` flag, but it exposes the `--to-dir` flag and adds examples to clarify the difference.

Comment 8 Sally 2021-02-10 21:34:30 UTC
After further review, the current flags do offer what is required. The linked PR will resolve the confusion around the flags by adding examples. 

For this bug specifically, it is possible to designate a destination directory to extract into, using the --path flag:

# Extract the busybox image to a temp directory
$ oc image extract docker.io/library/busybox:latest --path /:/tmp/busybox

I'm closing this as a duplicate of 1904006, and the PR https://github.com/openshift/oc/pull/729 that adds examples to help menu will resolve.

*** This bug has been marked as a duplicate of bug 1904006 ***

Comment 9 Sally 2021-02-10 21:39:52 UTC
The example above in Comment 8 is for extract, apologies. For 'oc image append' the added examples in PR 729 will be something like:

        # Add a new layer to the image and store the result on disk
        # This results in $(pwd)/v2/mysql/blobs,manifests
        oc image append --from mysql:latest --to file://mysql:local layer.tar.gz

        # Add a new layer to the image and store the result on disk in a designated directory
        # This will result in $(pwd)/mysql-local/v2/mysql/blobs,manifests
        oc image append --from mysql:latest --to file://mysql:local --dir mysql-local layer.tar.gz

        # Add a new layer to an image that is stored on disk (~/mysql-local/v2/image exists)
        oc image append --from-dir ~/mysql-local --to myregistry.com/myimage:latest layer.tar.gz

        # Add a new layer to an image that was mirrored to the current directory on disk (v2/image exists)
        oc image append --from-dir v2 --to myregistry.com/myimage:latest layer.tar.gz


Note You need to log in before you can comment on or make changes to this bug.