Bug 1927131

Summary: openshift-tests images --to-repository should not panic
Product: OpenShift Container Platform Reporter: Jian Zhang <jiazha>
Component: Test FrameworkAssignee: Devan Goodwin <dgoodwin>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.7CC: ccoleman
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-02 18:29:02 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 Jian Zhang 2021-02-10 07:06:06 UTC
Description of problem:
When I mirror the image to a repo, get the Golang panic.
I know the right usage is "openshift-tests images --to-repository repo/registry/xxx", however, it should not generate panic even if we specify the repo only.

[root@preserve-olm-env origin]# ./openshift-tests images --to-repository jiazha0210.mirror-registry.qe.azure.devcluster.openshift.com:5000
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
k8s.io/kubernetes/test/utils/image.mapConfigToRepos(0x9, 0x5e0977e, 0x21, 0x5d7f9c5, 0xf, 0x5d54dc3, 0x3, 0x0, 0x0, 0x0, ...)
	k8s.io/kubernetes.0/test/utils/image/manifest.go:292 +0x620
k8s.io/kubernetes/test/utils/image.GetMappedImageConfigs(0xc0004a1650, 0x0, 0x0, 0x0)
	k8s.io/kubernetes.0/test/utils/image/manifest.go:275 +0x20b
main.createImageMirrorForInternalImages(0x0, 0x0, 0xc001e6eaa0, 0x41, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	github.com/openshift/origin/cmd/openshift-tests/images.go:54 +0xc6
main.newImagesCommand.func1(0xc000ffeb00, 0xc001e6d180, 0x0, 0x2, 0x0, 0x0)
	github.com/openshift/origin/cmd/openshift-tests/openshift-tests.go:177 +0x297
github.com/spf13/cobra.(*Command).execute(0xc000ffeb00, 0xc001e6d160, 0x2, 0x2, 0xc000ffeb00, 0xc001e6d160)
	github.com/spf13/cobra.1/command.go:850 +0x453
github.com/spf13/cobra.(*Command).ExecuteC(0xc000ffe000, 0x0, 0x6b6a8e0, 0xa0a22e0)
	github.com/spf13/cobra.1/command.go:958 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra.1/command.go:895
main.main.func1(0xc000ffe000, 0x0, 0x0)
	github.com/openshift/origin/cmd/openshift-tests/openshift-tests.go:84 +0x94
main.main()
	github.com/openshift/origin/cmd/openshift-tests/openshift-tests.go:85 +0x3e4

Version-Release number of selected component (if applicable):
the master branch of origin, openshift-tests version: v4.1.0-3600-gaf3f04c

How reproducible:
always

Steps to Reproduce:
1. Make build the openshift-tests binary.
[root@preserve-olm-env origin]# make build
go build -mod=vendor -trimpath -ldflags "-s -w -X github.com/openshift/origin/pkg/version.versionFromGit="v4.1.0-3600-gaf3f04c" -X github.com/openshift/origin/pkg/version.commitFromGit="af3f04c" -X github.com/openshift/origin/pkg/version.gitTreeState="clean" -X github.com/openshift/origin/pkg/version.buildDate="2021-02-09T09:33:49Z" " github.com/openshift/origin/cmd/openshift-tests

2. Run "./openshift-tests images --to-repository jiazha0210.mirror-registry.qe.azure.devcluster.openshift.com:5000"


Actual results:
[root@preserve-olm-env origin]# ./openshift-tests images --to-repository jiazha0210.mirror-registry.qe.azure.devcluster.openshift.com:5000
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
k8s.io/kubernetes/test/utils/image.mapConfigToRepos(0x9, 0x5e0977e, 0x21, 0x5d7f9c5, 0xf, 0x5d54dc3, 0x3, 0x0, 0x0, 0x0, ...)
	k8s.io/kubernetes.0/test/utils/image/manifest.go:292 +0x620
k8s.io/kubernetes/test/utils/image.GetMappedImageConfigs(0xc0004a1650, 0x0, 0x0, 0x0)
	k8s.io/kubernetes.0/test/utils/image/manifest.go:275 +0x20b
main.createImageMirrorForInternalImages(0x0, 0x0, 0xc001e6eaa0, 0x41, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	github.com/openshift/origin/cmd/openshift-tests/images.go:54 +0xc6
main.newImagesCommand.func1(0xc000ffeb00, 0xc001e6d180, 0x0, 0x2, 0x0, 0x0)
	github.com/openshift/origin/cmd/openshift-tests/openshift-tests.go:177 +0x297
github.com/spf13/cobra.(*Command).execute(0xc000ffeb00, 0xc001e6d160, 0x2, 0x2, 0xc000ffeb00, 0xc001e6d160)
	github.com/spf13/cobra.1/command.go:850 +0x453
github.com/spf13/cobra.(*Command).ExecuteC(0xc000ffe000, 0x0, 0x6b6a8e0, 0xa0a22e0)
	github.com/spf13/cobra.1/command.go:958 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra.1/command.go:895
main.main.func1(0xc000ffe000, 0x0, 0x0)
	github.com/openshift/origin/cmd/openshift-tests/openshift-tests.go:84 +0x94
main.main()
	github.com/openshift/origin/cmd/openshift-tests/openshift-tests.go:85 +0x3e4

Expected results:
No panic.

Additional info:

Comment 1 Steve Kuznetsov 2021-05-17 19:07:01 UTC
@Clayton - who should own this?

Comment 3 Red Hat Bugzilla 2023-09-15 01:00:55 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days