Bug 1810533

Summary: oc image mirror shouldn't default to mirroring manifest lists
Product: OpenShift Container Platform Reporter: Kevin Rizza <krizza>
Component: ocAssignee: Kevin Rizza <krizza>
Status: CLOSED ERRATA QA Contact: Bruno Andrade <bandrade>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.3.zCC: aos-bugs, arghosh, ecordell, jokerman, maszulik, mfojtik, xiuwang, yinzhou
Target Milestone: ---   
Target Release: 4.3.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1810268 Environment:
Last Closed: 2020-03-24 14:34:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1810268    
Bug Blocks:    

Description Kevin Rizza 2020-03-05 12:55:58 UTC
+++ This bug was initially created as a clone of Bug #1810268 +++

+++ This bug was initially created as a clone of Bug #1810256 +++

Description of problem:

With this pr https://github.com/openshift/oc/pull/298 we introduced a change to enable `oc adm catalog mirror` to force mirror manifest list digests. However, we also introduced the behavior that oc image mirror also always enables that force option with no method of disabling it.

`oc image mirror` should retain the old default behavior (oc image mirror doesn't mirror the manifest list if there is only a single image in the list) with two exceptions:

1. There should be an explicit option to force the manifest list mirroring (like `--force-manifest-list`)
2. If --filter-by-os is passed a wildcard (`--filter-by-os=.*`) it should forcefully mirror the manifestlist.


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

4.5

How reproducible:

Always


Steps to Reproduce:
1. Run oc image mirror against a manifest list digest. Ex:

$ ./oc image mirror registry.redhat.io/openshift4/ose-sriov-network-webhook@sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d localhost:5000/kevinrizza/sriov:latest --dry-run


Actual results:

Manifest list was mirrored:

./oc image mirror registry.redhat.io/openshift4/ose-sriov-network-webhook@sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d localhost:5000/kevinrizza/sriov:latest --dry-run

localhost:5000/  
kevinrizza/sriov    
blobs:
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:455ea8ab06218495bbbcb14b750a0d644897b24f8c5dcf9e8698e27882583412 1.575KiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:4377e81e5655f5852beea18997f4ff77d4f513b18d04587a275d30ea22874ae3 5.002KiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:13be0effd90b69b59a7109cbb6133186be48c386dfb5a69e99965ad383451789 3.333MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:edf561fefe181b648d6502acfd17fd6a6bb8d378057dae272f36ffc850f65bf8 7.842MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:a27f668f2f9d1846948029fb27f6da2848e0764888c8f98b3f677035073a255d 8.893MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:bb13d92caffa705f32b8a7f9f661e07ddede310c6ccfa78fb53a49539740e29b 72.71MiB
    manifests:
      sha256:2288935e7d2e4c1653ecb287c35a0dda11dddd10f034d85c025b95219a5f37ee
      sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d
      sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d -> latest
  stats: shared=0 unique=6 size=92.78MiB ratio=1.00

phase 0:
  localhost:5000 kevinrizza/sriov blobs=6 mounts=0 manifests=3 shared=0

info: Planning completed in 1.75s
info: Dry run complete

Expected results:

Just the underlying container image digest was mirrored

Comment 3 XiuJuan Wang 2020-03-12 05:31:00 UTC
Image mirror worked as expected. Marking as VERIFIED.
$./oc version 
Client Version: 4.3.6-202003110601-62c8cca

Mirror the multi-arch images 

1. without keep-manifest-list, default don't mirror manifest list
 $./oc image mirror registry.redhat.io/openshift4/ose-sriov-network-webhook@sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test:1.0  
vsphere.mirror-registry.qe.devcluster.openshift.com:5000/
  xiuwang1/test
    blobs:
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:455ea8ab06218495bbbcb14b750a0d644897b24f8c5dcf9e8698e27882583412 1.575KiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:4377e81e5655f5852beea18997f4ff77d4f513b18d04587a275d30ea22874ae3 5.002KiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:13be0effd90b69b59a7109cbb6133186be48c386dfb5a69e99965ad383451789 3.333MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:edf561fefe181b648d6502acfd17fd6a6bb8d378057dae272f36ffc850f65bf8 7.842MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:a27f668f2f9d1846948029fb27f6da2848e0764888c8f98b3f677035073a255d 8.893MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:bb13d92caffa705f32b8a7f9f661e07ddede310c6ccfa78fb53a49539740e29b 72.71MiB
    manifests:
      sha256:2288935e7d2e4c1653ecb287c35a0dda11dddd10f034d85c025b95219a5f37ee -> 1.0
  stats: shared=0 unique=6 size=92.78MiB ratio=1.00

phase 0:
  vsphere.mirror-registry.qe.devcluster.openshift.com:5000 xiuwang1/test blobs=6 mounts=0 manifests=1 shared=0

info: Planning completed in 3.57s
uploading: vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test sha256:edf561fefe181b648d6502acfd17fd6a6bb8d378057dae272f36ffc850f65bf8 7.842MiB
uploading: vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test sha256:a27f668f2f9d1846948029fb27f6da2848e0764888c8f98b3f677035073a255d 8.893MiB
uploading: vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test sha256:13be0effd90b69b59a7109cbb6133186be48c386dfb5a69e99965ad383451789 3.333MiB
uploading: vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test sha256:bb13d92caffa705f32b8a7f9f661e07ddede310c6ccfa78fb53a49539740e29b 72.71MiB
sha256:2288935e7d2e4c1653ecb287c35a0dda11dddd10f034d85c025b95219a5f37ee vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test:1.0
info: Mirroring completed in 11m22.07s (142.6kB/s)

2. set keep-manifest-list to false, don't mirror manifest list

$./oc image mirror registry.redhat.io/openshift4/ose-sriov-network-webhook@sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test:1.0  --keep-manifest-list=false
vsphere.mirror-registry.qe.devcluster.openshift.com:5000/
  xiuwang1/test
    manifests:
      sha256:2288935e7d2e4c1653ecb287c35a0dda11dddd10f034d85c025b95219a5f37ee -> 1.0
  stats: shared=0 unique=0 size=0B

phase 0:
  vsphere.mirror-registry.qe.devcluster.openshift.com:5000 xiuwang1/test blobs=0 mounts=0 manifests=1 shared=0

info: Planning completed in 5.58s
sha256:2288935e7d2e4c1653ecb287c35a0dda11dddd10f034d85c025b95219a5f37ee vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test:1.0
info: Mirroring completed in 120ms (0B/s)

3. set keep-manifest-list to true, will mirror manifest list
$./oc image mirror registry.redhat.io/openshift4/ose-sriov-network-webhook@sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test:1.0  --keep-manifest-list=true --dry-run
vsphere.mirror-registry.qe.devcluster.openshift.com:5000/
  xiuwang1/test
    blobs:
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:455ea8ab06218495bbbcb14b750a0d644897b24f8c5dcf9e8698e27882583412 1.575KiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:4377e81e5655f5852beea18997f4ff77d4f513b18d04587a275d30ea22874ae3 5.002KiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:13be0effd90b69b59a7109cbb6133186be48c386dfb5a69e99965ad383451789 3.333MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:edf561fefe181b648d6502acfd17fd6a6bb8d378057dae272f36ffc850f65bf8 7.842MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:a27f668f2f9d1846948029fb27f6da2848e0764888c8f98b3f677035073a255d 8.893MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:bb13d92caffa705f32b8a7f9f661e07ddede310c6ccfa78fb53a49539740e29b 72.71MiB
    manifests:
      sha256:2288935e7d2e4c1653ecb287c35a0dda11dddd10f034d85c025b95219a5f37ee
      sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d
      sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d -> 1.0
  stats: shared=0 unique=6 size=92.78MiB ratio=1.00

phase 0:
  vsphere.mirror-registry.qe.devcluster.openshift.com:5000 xiuwang1/test blobs=6 mounts=0 manifests=3 shared=0

info: Planning completed in 4.9s
info: Dry run complete

4.Only set --filter-by-os='.*' , will mirror the manifest list
./oc image mirror registry.redhat.io/openshift4/ose-sriov-network-webhook@sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d vsphere.mirror-registry.qe.devcluster.openshift.com:5000/xiuwang1/test:1.0 --filter-by-os='.*' --dry-run
vsphere.mirror-registry.qe.devcluster.openshift.com:5000/
  xiuwang1/test
    blobs:
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:455ea8ab06218495bbbcb14b750a0d644897b24f8c5dcf9e8698e27882583412 1.575KiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:4377e81e5655f5852beea18997f4ff77d4f513b18d04587a275d30ea22874ae3 5.002KiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:13be0effd90b69b59a7109cbb6133186be48c386dfb5a69e99965ad383451789 3.333MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:edf561fefe181b648d6502acfd17fd6a6bb8d378057dae272f36ffc850f65bf8 7.842MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:a27f668f2f9d1846948029fb27f6da2848e0764888c8f98b3f677035073a255d 8.893MiB
      registry.redhat.io/openshift4/ose-sriov-network-webhook sha256:bb13d92caffa705f32b8a7f9f661e07ddede310c6ccfa78fb53a49539740e29b 72.71MiB
    manifests:
      sha256:2288935e7d2e4c1653ecb287c35a0dda11dddd10f034d85c025b95219a5f37ee
      sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d
      sha256:d269ed4a4cbc5d8ecb2027891f2bd42ffaa61ce2785e38bd761ccbcd2d794c1d -> 1.0
  stats: shared=0 unique=6 size=92.78MiB ratio=1.00

phase 0:
  vsphere.mirror-registry.qe.devcluster.openshift.com:5000 xiuwang1/test blobs=6 mounts=0 manifests=3 shared=0

info: Planning completed in 4.9s
info: Dry run complete

Comment 6 errata-xmlrpc 2020-03-24 14:34:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0858