Bug 2054911 - oc image mirror --from-dir ignores --from-dir
Summary: oc image mirror --from-dir ignores --from-dir
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.8
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
: ---
Assignee: Maciej Szulik
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-16 01:20 UTC by John Marley
Modified: 2022-02-16 23:53 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-02-16 23:53:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1807807 1 unspecified CLOSED oc image mirror --from-dir does not override --dir 2023-09-07 22:05:40 UTC

Description John Marley 2022-02-16 01:20:10 UTC
Description of problem:

This is the same problem described in bug 1807807 which was supposedly fixed in 4.3.  Trying to mirror from a directory to a registry fails:

# oc image mirror -a ${LOCAL_SECRET_JSON} --from-dir=exportdir file://openshift/release:4.8.29* ${LOCAL_REGISTRY}/ocp4
error: you must specify at least one source image to pull and the destination to push to as SRC=DST or SRC DST [DST2 DST3 ...]

See the full output below.  It appears to be ignoring the --from-dir option.  I have tried full pathname and relative pathname with the same result.


Version-Release number of selected component (if applicable):

4.8.29


How reproducible:

Always


Steps to Reproduce:
1. Run this command:

# oc image mirror --from-dir=/home/otjm452/mirror file://v2/openshift/release:4.8.29-* gitlab01.priv.support.energyq.net.au:5000/tivoli/openshift/ocp4/openshift --loglevel=5

2.
3.


Actual results:

I0216 11:07:02.352431   21500 config.go:128] looking for config.json at /root/.docker/config.json
I0216 11:07:02.352484   21500 config.go:94] looking for .dockercfg at /root/.dockercfg
I0216 11:07:02.352565   21500 file.go:30] Repository https://registry-1.docker.io v2/openshift/release
I0216 11:07:02.352608   21500 options.go:59] Search for "4.8.29-*" (^4\.8\.29-.*.*$) found: []
error: you must specify at least one source image to pull and the destination to push to as SRC=DST or SRC DST [DST2 DST3 ...]


Expected results:

Containers are pushed


Additional info:

Local mirror directory looks like:

# find ./mirror -print
./mirror
./mirror/config
./mirror/config/signature-sha256-9f9df3ff16e7ddd66.yaml
./mirror/v2/
./mirror/v2/openshift
./mirror/v2/openshift/release
./mirror/v2/openshift/release/blobs
./mirror/v2/openshift/release/blobs/sha256:ba60b...
...
./mirror/v2/openshift/release/manifests
./mirror/v2/openshift/release/manifests/sha256:3771...
./mirror/v2/openshift/release/manifests/4.8.29-x86_64-cluster-version-operator
./mirror/v2/openshift/release/manifests/4.8.29-x86_64-azure-disk-csi-driver-operator
..etc..

Comment 1 John Marley 2022-02-16 03:41:07 UTC
I've also tried these variations:

oc image mirror --from-dir=/home/otjm452/mirror file://openshift/release:4.8.29-* gitlab01.priv.support.energyq.net.au:5000/tivoli/openshift/ocp4/openshift --loglevel=5 

oc image mirror --from-dir=/home/otjm452/mirror file://openshift/release:4.8.29-* gitlab01.priv.support.energyq.net.au:5000/tivoli/openshift/ocp4/openshift --loglevel=5 --dir=notset

oc image mirror --dir=/home/otjm452/mirror file://openshift/release:4.8.29-* gitlab01.priv.support.energyq.net.au:5000/tivoli/openshift/ocp4/openshift --loglevel=5

oc image mirror --dir=/home/otjm452/mirror file://openshift/release:4.8.29-* gitlab01.priv.support.energyq.net.au:5000/tivoli/openshift/ocp4/openshift --loglevel=5 --from-dir=notset

all produce the same results.

I've also run it with strace and I can see it running newfstatat() against all the files under mirror/v2/openshift/release/manifests, but not the files under mirror/v2/openshift/release/blobs, so it looks like the mirror has files where they're expected.  It's just not matching the files.

Comment 2 John Marley 2022-02-16 03:41:50 UTC
Oh, I've also tried oc 4.8.23 and 4.9.9 with the same results.

Comment 3 John Marley 2022-02-16 04:18:55 UTC
I've also tried 4.8.3 (with the same results) which is the version in which this problem was supposedly fixed according to https://access.redhat.com/solutions/4952051

Comment 4 John Marley 2022-02-16 23:53:29 UTC
Found the solution.  When the mirror was copied to the internal network, the manifest symbolic links were not preserved.  With the links restored it's proceeding as expected.


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