Skip to content

Commit c1f8d9e

Browse files
committed
OCPBUGS-60903: oc adm release extract: add oc-mirror to the tools list
This will allow oc-mirror to be injected with the OCP release version it's a part of.
1 parent fa1bc38 commit c1f8d9e

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

pkg/cli/admin/release/extract_tools.go

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,27 @@ var (
209209
program is [located on github](https://github.com/openshift/cloud-credential-operator).
210210
`)
211211

212+
readmeOCMirror = heredoc.Doc(`
213+
# OC Mirror Utility
214+
215+
The oc-mirror tool assists with mirroring OpenShift release content from a source
216+
registry to a target registry for disconnected install scenarios.
217+
218+
To learn more about OpenShift, visit [docs.openshift.com](https://docs.openshift.com)
219+
and select the version of OpenShift you are using.
220+
221+
## Installing the tools
222+
223+
After extracting this archive, move the \u0060oc-mirror\u0060 binary to a location on your
224+
PATH such as \u0060/usr/local/bin\u0060, or keep it in a temporary directory and
225+
reference it via \u0060./oc-mirror\u0060.
226+
227+
## License
228+
229+
OpenShift is licensed under the Apache Public License 2.0. The source code for this
230+
program is [located on github](https://github.com/openshift/oc-mirror).
231+
`)
232+
212233
// indicates that the architecture of the binary matches the release payload
213234
targetReleaseArch = "release-arch"
214235
)
@@ -526,6 +547,38 @@ func (o *ExtractOptions) extractCommand(command string) error {
526547
ArchiveFormat: "ccoctl-linux-rhel9-%s.tar.gz",
527548
TargetCommandName: "ccoctl",
528549
},
550+
{
551+
OS: "linux",
552+
Arch: targetReleaseArch,
553+
Command: "oc-mirror.rhel9",
554+
NewArch: true,
555+
InjectReleaseVersion: true,
556+
Mapping: extract.Mapping{Image: "oc-mirror", From: "usr/bin/oc-mirror.rhel9"},
557+
Readme: readmeOCMirror,
558+
ArchiveFormat: "oc-mirror.rhel9-%s.tar.gz",
559+
TargetCommandName: "oc-mirror",
560+
},
561+
{
562+
OS: "linux",
563+
Arch: targetReleaseArch,
564+
Command: "oc-mirror.rhel8",
565+
NewArch: true,
566+
InjectReleaseVersion: true,
567+
Mapping: extract.Mapping{Image: "oc-mirror", From: "usr/bin/oc-mirror.rhel8"},
568+
Readme: readmeOCMirror,
569+
ArchiveFormat: "oc-mirror.rhel8-%s.tar.gz",
570+
TargetCommandName: "oc-mirror",
571+
},
572+
{
573+
OS: "linux",
574+
Arch: targetReleaseArch,
575+
Command: "oc-mirror",
576+
NewArch: true,
577+
InjectReleaseVersion: true,
578+
Mapping: extract.Mapping{Image: "oc-mirror", From: "usr/bin/oc-mirror"},
579+
Readme: readmeOCMirror,
580+
ArchiveFormat: "oc-mirror-%s.tar.gz",
581+
},
529582
}
530583

531584
currentArch := runtime.GOARCH
@@ -587,7 +640,7 @@ func (o *ExtractOptions) extractCommand(command string) error {
587640
case len(command) > 0 && currentOS != "*":
588641
return fmt.Errorf("command %q does not exist in targets or does not support the operating system %q", o.Command, currentOS)
589642
case len(command) > 0:
590-
return fmt.Errorf("the supported commands are 'oc', 'openshift-install', `openshift-baremetal-install` and 'ccoctl'")
643+
return fmt.Errorf("the supported commands are 'oc', 'openshift-install', `openshift-baremetal-install`, 'ccoctl', and 'oc-mirror'")
591644
default:
592645
return fmt.Errorf("no available commands")
593646
}

0 commit comments

Comments
 (0)