Skip to content

Commit fd6bc5b

Browse files
Merge pull request #1104 from jhadvig/OCPBUGS-74686
OCPBUGS-74686: Add rhel8 and rhel9 oc binaries for Linux OS in CLI downloads
2 parents bdf006d + 2fa0e91 commit fd6bc5b

4 files changed

Lines changed: 58 additions & 5 deletions

File tree

bindata/assets/deployments/downloads-deployment.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,20 @@ spec:
154154
155155
for arch, operating_system, path in [
156156
('amd64', 'linux', '/usr/share/openshift/linux_amd64/oc'),
157+
('amd64', 'linux', '/usr/share/openshift/linux_amd64/oc.rhel8'),
158+
('amd64', 'linux', '/usr/share/openshift/linux_amd64/oc.rhel9'),
157159
('amd64', 'mac', '/usr/share/openshift/mac/oc'),
158160
('amd64', 'windows', '/usr/share/openshift/windows/oc.exe'),
159161
('arm64', 'linux', '/usr/share/openshift/linux_arm64/oc'),
162+
('arm64', 'linux', '/usr/share/openshift/linux_arm64/oc.rhel8'),
163+
('arm64', 'linux', '/usr/share/openshift/linux_arm64/oc.rhel9'),
160164
('arm64', 'mac', '/usr/share/openshift/mac_arm64/oc'),
161165
('ppc64le', 'linux', '/usr/share/openshift/linux_ppc64le/oc'),
166+
('ppc64le', 'linux', '/usr/share/openshift/linux_ppc64le/oc.rhel8'),
167+
('ppc64le', 'linux', '/usr/share/openshift/linux_ppc64le/oc.rhel9'),
162168
('s390x', 'linux', '/usr/share/openshift/linux_s390x/oc'),
169+
('s390x', 'linux', '/usr/share/openshift/linux_s390x/oc.rhel8'),
170+
('s390x', 'linux', '/usr/share/openshift/linux_s390x/oc.rhel9'),
163171
]:
164172
try:
165173
print(' Processing {} {} ({})...'.format(arch, operating_system, path), flush=True)
@@ -176,12 +184,16 @@ spec:
176184
target_path = os.path.join(arch, operating_system, basename)
177185
178186
print(' Creating directory...', flush=True)
179-
os.mkdir(os.path.join(arch, operating_system))
187+
os.makedirs(os.path.join(arch, operating_system), exist_ok=True)
180188
181189
print(' Creating symlink...', flush=True)
182190
os.symlink(path, target_path)
183191
184-
base_root, _ = os.path.splitext(basename)
192+
# Only strip .exe extension, keep everything else (e.g., oc.rhel8 stays oc.rhel8)
193+
if basename.endswith('.exe'):
194+
base_root = basename[:-4]
195+
else:
196+
base_root = basename
185197
archive_path_root = os.path.join(arch, operating_system, base_root)
186198
187199
# Start background thread to create archives

pkg/console/controllers/clidownloads/controller.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,20 @@ func PlatformBasedOCConsoleCLIDownloads(host, cliDownloadsName string) *v1.Conso
177177
archType string
178178
}{
179179
{"Linux for x86_64", "amd64/linux", "oc.tar"},
180+
{"Linux for x86_64 - RHEL 8", "amd64/linux", "oc.rhel8.tar"},
181+
{"Linux for x86_64 - RHEL 9", "amd64/linux", "oc.rhel9.tar"},
180182
{"Mac for x86_64", "amd64/mac", "oc.zip"},
181183
{"Windows for x86_64", "amd64/windows", "oc.zip"},
182184
{"Linux for ARM 64", "arm64/linux", "oc.tar"},
185+
{"Linux for ARM 64 - RHEL 8", "arm64/linux", "oc.rhel8.tar"},
186+
{"Linux for ARM 64 - RHEL 9", "arm64/linux", "oc.rhel9.tar"},
183187
{"Mac for ARM 64", "arm64/mac", "oc.zip"},
184188
{"Linux for IBM Power, little endian", "ppc64le/linux", "oc.tar"},
189+
{"Linux for IBM Power, little endian - RHEL 8", "ppc64le/linux", "oc.rhel8.tar"},
190+
{"Linux for IBM Power, little endian - RHEL 9", "ppc64le/linux", "oc.rhel9.tar"},
185191
{"Linux for IBM Z", "s390x/linux", "oc.tar"},
192+
{"Linux for IBM Z - RHEL 8", "s390x/linux", "oc.rhel8.tar"},
193+
{"Linux for IBM Z - RHEL 9", "s390x/linux", "oc.rhel9.tar"},
186194
}
187195

188196
links := []v1.CLIDownloadLink{}
@@ -205,7 +213,7 @@ func PlatformBasedOCConsoleCLIDownloads(host, cliDownloadsName string) *v1.Conso
205213
Spec: v1.ConsoleCLIDownloadSpec{
206214
Description: `With the OpenShift command line interface, you can create applications and manage OpenShift projects from a terminal.
207215
208-
The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features.
216+
The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features. You can download oc using the following links.
209217
`,
210218
DisplayName: "oc - OpenShift Command Line Interface (CLI)",
211219
Links: links,

pkg/console/controllers/clidownloads/controller_test.go

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,22 @@ func TestPlatformBasedOCConsoleCLIDownloads(t *testing.T) {
116116
Spec: v1.ConsoleCLIDownloadSpec{
117117
Description: `With the OpenShift command line interface, you can create applications and manage OpenShift projects from a terminal.
118118
119-
The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features.
119+
The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features. You can download oc using the following links.
120120
`,
121121
DisplayName: "oc - OpenShift Command Line Interface (CLI)",
122122
Links: []v1.CLIDownloadLink{
123123
{
124124
Href: "https://www.example.com/amd64/linux/oc.tar",
125125
Text: "Download oc for Linux for x86_64",
126126
},
127+
{
128+
Href: "https://www.example.com/amd64/linux/oc.rhel8.tar",
129+
Text: "Download oc for Linux for x86_64 - RHEL 8",
130+
},
131+
{
132+
Href: "https://www.example.com/amd64/linux/oc.rhel9.tar",
133+
Text: "Download oc for Linux for x86_64 - RHEL 9",
134+
},
127135
{
128136
Href: "https://www.example.com/amd64/mac/oc.zip",
129137
Text: "Download oc for Mac for x86_64",
@@ -136,6 +144,14 @@ The oc binary offers the same capabilities as the kubectl binary, but it is furt
136144
Href: "https://www.example.com/arm64/linux/oc.tar",
137145
Text: "Download oc for Linux for ARM 64",
138146
},
147+
{
148+
Href: "https://www.example.com/arm64/linux/oc.rhel8.tar",
149+
Text: "Download oc for Linux for ARM 64 - RHEL 8",
150+
},
151+
{
152+
Href: "https://www.example.com/arm64/linux/oc.rhel9.tar",
153+
Text: "Download oc for Linux for ARM 64 - RHEL 9",
154+
},
139155
{
140156
Href: "https://www.example.com/arm64/mac/oc.zip",
141157
Text: "Download oc for Mac for ARM 64",
@@ -144,10 +160,26 @@ The oc binary offers the same capabilities as the kubectl binary, but it is furt
144160
Href: "https://www.example.com/ppc64le/linux/oc.tar",
145161
Text: "Download oc for Linux for IBM Power, little endian",
146162
},
163+
{
164+
Href: "https://www.example.com/ppc64le/linux/oc.rhel8.tar",
165+
Text: "Download oc for Linux for IBM Power, little endian - RHEL 8",
166+
},
167+
{
168+
Href: "https://www.example.com/ppc64le/linux/oc.rhel9.tar",
169+
Text: "Download oc for Linux for IBM Power, little endian - RHEL 9",
170+
},
147171
{
148172
Href: "https://www.example.com/s390x/linux/oc.tar",
149173
Text: "Download oc for Linux for IBM Z",
150174
},
175+
{
176+
Href: "https://www.example.com/s390x/linux/oc.rhel8.tar",
177+
Text: "Download oc for Linux for IBM Z - RHEL 8",
178+
},
179+
{
180+
Href: "https://www.example.com/s390x/linux/oc.rhel9.tar",
181+
Text: "Download oc for Linux for IBM Z - RHEL 9",
182+
},
151183
{
152184
Href: "https://www.example.com/oc-license",
153185
Text: "LICENSE",

test/e2e/downloads_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func TestDownloadsEndpoint(t *testing.T) {
4242
req := getRequest(t, link.Href)
4343
client := getInsecureClient()
4444
resp, err := client.Do(req)
45+
t.Logf("Requesting %s at %s...", link.Text, link.Href)
4546

4647
if err != nil {
4748
t.Fatalf("http error getting %s at %s: %s", link.Text, link.Href, err)
@@ -50,6 +51,6 @@ func TestDownloadsEndpoint(t *testing.T) {
5051
t.Fatalf("http error for %s at %s: %d %s", link.Text, link.Href, resp.StatusCode, http.StatusText(resp.StatusCode))
5152
}
5253
resp.Body.Close()
53-
t.Logf("%s %s\n", link.Text, resp.Status)
54+
t.Logf("%s %s...", link.Text, resp.Status)
5455
}
5556
}

0 commit comments

Comments
 (0)