Bug 1878823

Summary: "oc adm release mirror" generating incomplete imageContentSources when using "--to" and "--to-release-image"
Product: OpenShift Container Platform Reporter: Robert Heinzmann <rheinzma>
Component: ocAssignee: Sally <somalley>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.5CC: aos-bugs, jokerman, mfojtik
Target Milestone: ---   
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-24 15:17:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Robert Heinzmann 2020-09-14 15:13:16 UTC
Description of problem:

When running "oc adm release mirror" command with both flags "--to" and "--to-release-image" and both having a different repository URL (same registry, different org or image name), the printed "imageContentSources" example is missing the release image.

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

4.5.8

How reproducible:

Always

Steps to Reproduce:
1. Mirror with 

oc adm -a pull-secret.txt release mirror --from=quay.io/openshift-release-dev/ocp-release:4.5.8-x86_64 --to=quay-intern.example.com/ocp4/openshift-release-dev --to-release-image=quay-intern.example.com/ocp4/ocp-release:4.5.8-x86_64

2. Check generated imageContentSources

Actual results:

~~~
imageContentSources:
- mirrors:
  - quay-intern.example.com/ocp4/openshift-release-dev
  source: quay.io/openshift-release-dev/ocp-release
- mirrors:
  - quay-intern.example.com/ocp4/openshift-release-dev
  source: quay.io/openshift-release-dev/ocp-v4.0-art-dev
~~~

Expected results:

~~~
imageContentSources:
- mirrors:
  - quay-intern.example.com/ocp4/ocp-release
  source: quay.io/openshift-release-dev/ocp-release
- mirrors:
  - quay-intern.example.com/ocp4/openshift-release-dev
  source: quay.io/openshift-release-dev/ocp-v4.0-art-dev
~~~

Additional info:

It seems the printImageContentInstructions function is only considering the "--to" cli option and ignores the "--to-release-image" setting in https://github.com/openshift/oc/blob/a695d74ef1aee9a3f605d38dd8b6fae2062b63fc/pkg/cli/admin/release/mirror.go#L815

Comment 2 Sally 2020-10-01 21:37:11 UTC
This missed my attention last sprint, as we were focused on other bugs. I will be sure to pick it up in the upcoming sprint.

Comment 3 Sally 2020-10-23 17:21:26 UTC
Actively working on this, adding UpcomingSprint.

Comment 5 Sally 2020-11-12 18:57:30 UTC
Sorry for the delay, opened a PR w/ oc to resolve this, thanks.
Adding UpcomingSprint, to track review of the PR.

Comment 12 errata-xmlrpc 2021-02-24 15:17:46 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 (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), 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/RHSA-2020:5633