Bug 2090819 - oc-mirror does not catch invalid registry input when a namespace is specified
Summary: oc-mirror does not catch invalid registry input when a namespace is specified
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.11
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.11.0
Assignee: Alex
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-26 15:47 UTC by Jennifer Power
Modified: 2022-08-10 11:15 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:14:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc-mirror pull 479 0 None open Bug 2090819: fix(mirror): Add helpful warnings for possible unexpected docker refe… 2022-05-26 17:39:11 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 11:15:00 UTC

Description Jennifer Power 2022-05-26 15:47:40 UTC
Description of problem:

oc-mirror does not catch invalid registry input when a namespace is specified


Version-Release number of selected component (if applicable):
Client Version: version.Info{Major:"0", Minor:"2", GitVersion:"v0.2.0-alpha.1", GitCommit:"c732df4804f571b3d6a01aa24d58fed22c495129", GitTreeState:"clean", BuildDate:"2022-03-23T11:33:16Z", GoVersion:"go1.17.1", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:
100%


Steps to Reproduce:
1. oc-mirror --config ~/configs/imageset-config.yaml docker://registry:5000/test
error: error rebuilding catalog images from file-based catalogs: POST https://index.docker.io/v2/test/redhat/redhat-operator-index/blobs/uploads/: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:test/redhat/redhat-operator-index Type:repository] map[Action:push Class: Name:test/redhat/redhat-operator-index Type:repository]]

Actual results:

The error is caught very late in the processes and not during argument checking


Expected results:

A less ambiguous error


Additional info:
https://github.com/openshift/oc-mirror/issues/382

Comment 3 zhou ying 2022-06-09 03:09:32 UTC
 with older client:

./oc-mirror version 
Client Version: version.Info{Major:"0", Minor:"2", GitVersion:"v0.2.0-alpha.1", GitCommit:"c5d347f0edf0a70f4dfef65828ba6835d8993c65", GitTreeState:"clean", BuildDate:"2022-03-18T21:28:02Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}

./oc-mirror --config deleteimage/settingconfig.yaml docker://registry:5000
error: destination registry must consist of registry host and namespace(s) only

./oc-mirror --config deleteimage/settingconfig.yaml docker://registry:5000/test
INFO Checking push permissions for registry:5000  
error: error checking push permissions for registry:5000: creating push check transport for registry:5000 failed: Get "https://registry:5000/v2/": Service Unavailable



with latest oc-mirror :

oc-mirror version 
Client Version: version.Info{Major:"", Minor:"", GitVersion:"4.11.0-202206070117.p0.gc7201c9.assembly.stream-c7201c9", GitCommit:"c7201c98a6c27773ba2414d4735ab97fd35d5c75", GitTreeState:"clean", BuildDate:"2022-06-07T01:51:03Z", GoVersion:"go1.18", Compiler:"gc", Platform:"linux/amd64"}
[root@localhost ocmirrortest]# oc-mirror --config deleteimage/settingconfig.yaml  docker://registry:5000
The docker reference was parsed as image:tag, not as hostname:port.
To specify a registry, use a qualified hostname.
For example, instead of docker://registry:5000, use docker://registry.localdomain:5000
error: destination registry must consist of registry host and namespace(s) only, and must not include an image tag or ID

oc-mirror --config deleteimage/settingconfig.yaml  docker://registry:5000/test
Checking push permissions for registry:5000
error: error checking push permissions for registry:5000: creating push check transport for registry:5000 failed: Get "https://registry:5000/v2/": Service Unavailable

Comment 5 errata-xmlrpc 2022-08-10 11:14:36 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.