Bug 2087024 - The oc-mirror result mapping.txt is not correct , can’t be used by `oc image mirror` command
Summary: The oc-mirror result mapping.txt is not correct , can’t be used by `oc image ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.11
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.11.0
Assignee: Alex
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-17 07:07 UTC by zhou ying
Modified: 2022-08-10 11:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-10 11:12:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc-mirror pull 469 0 None open [WIP] Bug 2087024: fix(mapping): modifies mapping.txt for compat… 2022-05-17 14:58:59 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 11:12:45 UTC

Description zhou ying 2022-05-17 07:07:35 UTC
Description of problem:
The oc-mirror result mapping.txt is not correct , can’t be used by `oc image mirror` command


Version-Release number of selected component (if applicable):
oc-mirror version 
Client Version: version.Info{Major:"", Minor:"", GitVersion:"4.11.0-202205131159.p0.g7bde4c7.assembly.stream-7bde4c7", GitCommit:"7bde4c7bde6b829a34592b2d12115fb38b15576f", GitTreeState:"clean", BuildDate:"2022-05-13T12:59:14Z", GoVersion:"go1.18", Compiler:"gc", Platform:"linux/amd64"}

How reproducible:
always

Steps to Reproduce:
1. Use oc-mirror with dry-run to create the mapping.txt :
cat setting.yaml 
kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v1alpha2
storageConfig:
  registry:
    skipTLS: false
    imageURL: xxxxx.us-east-2.compute.amazonaws.com:5000/test:latest
mirror:
  platform:
    channels:
    - name: stable-4.10
      type: ocp
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.11
    packages:
    - name: serverless-operator
      channels:
      - name: stable
  additionalImages:
  - name: registry.redhat.io/ubi8/ubi:latest
  helm: {}

`oc-mirror --config setting.yaml docker://xxxxx.us-east-2.compute.amazonaws.com:5000/test  --dry-run`

Check the result mapping.txt by `oc image mirror` command
Actual result:
2. Can’t use the result mapping.txt by `oc image mirror` command:
cat /tmp/mapping.txt 
quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:63364747637b0e0b595e709e8192f3010240f08936be0370be0072bb4b447e43=ec2-18-119-110-153.us-east-2.compute.amazonaws.com:5000/test/openshift/release@sha256:63364747637b0e0b595e709e8192f3010240f08936be0370be0072bb4b447e43
quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:487660f0e6fa0efea2c00793c52d3f0de228412732640dc07f7d3a0ab5139f48=ec2-18-119-110-153.us-east-2.compute.amazonaws.com:5000/test/openshift/release@sha256:487660f0e6fa0efea2c00793c52d3f0de228412732640dc07f7d3a0ab5139f48

……

oc image mirror  --filter-by-os '.*' -f /tmp/mapping.txt --max-per-registry 1  --skip-multiple-scopes=true
Warning: the default reading order of registry auth file will be changed from "${HOME}/.docker/config.json" to podman registry config locations in the future version of oc. "${HOME}/.docker/config.json" is deprecated, but can still be used for storing credentials as a fallback. See https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md for the order of podman registry config locations.
error: file /tmp/mapping.txt, line 1: you must specify a tag for DST or leave it blank to only push by digest



Expected results:
Should create the correct format for mapping.txt and could be used by `oc image mirror` command.


Additional info:
The correct format for mapping.txt example:
cat manifests-ocp4-index-1652767008/mapping.txt 
registry.redhat.io/amq7/amq-streams-kafka-27-rhel8@sha256:dc9399239b3f06b6c2a020af25cf6be60d3931cb5ff3cb79b9f2e40075d2ad18=ec2-18-119-110-153.us-east-2.compute.amazonaws.com:5000/test/amq7-amq-streams-kafka-27-rhel8:8ed7fc5f
registry.stage.redhat.io/amq7/amqstreams-rhel7-operator-metadata@sha256:eaa66e127f03083033a3e64b2e9f08b8f1157440fdc0b7bf80cc62f1af24452e=ec2-18-119-110-153.us-east-2.compute.amazonaws.com:5000/test/amq7-amqstreams-rhel7-operator-metadata:53ce1f20
……

Comment 3 zhou ying 2022-06-06 06:24:52 UTC
checked with latest version , the issue has fixed:

oc-mirror --config filter-quay.yaml  docker://localhost:5000 --dry-run 
Checking push permissions for localhost:5000
.....

phase 0:
  localhost:5000 openshift4/poison-pill-manager-operator-bundle blobs=3 mounts=0 manifests=1 shared=0
  localhost:5000 openshift4/poison-pill-manager-rhel8-operator  blobs=4 mounts=0 manifests=3 shared=0

info: Planning completed in 7.09s
info: Dry run complete
Writing image mapping to oc-mirror-workspace/mapping.txt


oc image mirror -f mapping.txt --max-per-registry 1  --skip-multiple-scopes=true --insecure
Warning: the default reading order of registry auth file will be changed from "${HOME}/.docker/config.json" to podman registry config locations in the future version of oc. "${HOME}/.docker/config.json" is deprecated, but can still be used for storing credentials as a fallback. See https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md for the order of podman registry config locations.
......

info: Planning completed in 2.75s
uploading: localhost:5000/openshift4/poison-pill-manager-operator-bundle sha256:54161455904bd0ac5535d1bbd6e6458f338aa74cfdc68c634104d07fbd59b883 125KiB
uploading: localhost:5000/openshift4/poison-pill-manager-rhel8-operator sha256:8dfe9326f733b815c486432e93e0a97f03e90e7cc35def9511cd1efa7f917f56 77.75MiB
uploading: localhost:5000/openshift4/poison-pill-manager-rhel8-operator sha256:ccb9abdffd6944b407c3a084a7b4d0a7eca5a97bfb59755b393cfaed12b45513 19.73MiB
sha256:1291a164c9292d228e9e51bd03bf9c578103453b8b3117bf2428efca9f97eefd localhost:5000/openshift4/poison-pill-manager-operator-bundle:d948e527
sha256:82730d4ab7980dad55e27e123fe12a3f9cf98144ed422ce2b8a168112adc794d localhost:5000/openshift4/poison-pill-manager-rhel8-operator:5275c3ae
info: Mirroring completed in 10.06s (10.16MB/s)

Comment 5 errata-xmlrpc 2022-08-10 11:12:29 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 (Important: OpenShift Container Platform 4.11.0 bug fix and security 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-2022:5069


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