Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions bindata/assets/deployments/downloads-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,20 @@ spec:

for arch, operating_system, path in [
('amd64', 'linux', '/usr/share/openshift/linux_amd64/oc'),
('amd64', 'linux', '/usr/share/openshift/linux_amd64/oc.rhel8'),
('amd64', 'linux', '/usr/share/openshift/linux_amd64/oc.rhel9'),
('amd64', 'mac', '/usr/share/openshift/mac/oc'),
('amd64', 'windows', '/usr/share/openshift/windows/oc.exe'),
('arm64', 'linux', '/usr/share/openshift/linux_arm64/oc'),
('arm64', 'linux', '/usr/share/openshift/linux_arm64/oc.rhel8'),
('arm64', 'linux', '/usr/share/openshift/linux_arm64/oc.rhel9'),
('arm64', 'mac', '/usr/share/openshift/mac_arm64/oc'),
('ppc64le', 'linux', '/usr/share/openshift/linux_ppc64le/oc'),
('ppc64le', 'linux', '/usr/share/openshift/linux_ppc64le/oc.rhel8'),
('ppc64le', 'linux', '/usr/share/openshift/linux_ppc64le/oc.rhel9'),
('s390x', 'linux', '/usr/share/openshift/linux_s390x/oc'),
('s390x', 'linux', '/usr/share/openshift/linux_s390x/oc.rhel8'),
('s390x', 'linux', '/usr/share/openshift/linux_s390x/oc.rhel9'),
]:
try:
print(' Processing {} {} ({})...'.format(arch, operating_system, path), flush=True)
Expand All @@ -176,12 +184,16 @@ spec:
target_path = os.path.join(arch, operating_system, basename)

print(' Creating directory...', flush=True)
os.mkdir(os.path.join(arch, operating_system))
os.makedirs(os.path.join(arch, operating_system), exist_ok=True)

print(' Creating symlink...', flush=True)
os.symlink(path, target_path)

base_root, _ = os.path.splitext(basename)
# Only strip .exe extension, keep everything else (e.g., oc.rhel8 stays oc.rhel8)
if basename.endswith('.exe'):
base_root = basename[:-4]
else:
base_root = basename
archive_path_root = os.path.join(arch, operating_system, base_root)

# Start background thread to create archives
Expand Down
10 changes: 9 additions & 1 deletion pkg/console/controllers/clidownloads/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,20 @@ func PlatformBasedOCConsoleCLIDownloads(host, cliDownloadsName string) *v1.Conso
archType string
}{
{"Linux for x86_64", "amd64/linux", "oc.tar"},
{"Linux for x86_64 - RHEL 8", "amd64/linux", "oc.rhel8.tar"},
{"Linux for x86_64 - RHEL 9", "amd64/linux", "oc.rhel9.tar"},
{"Mac for x86_64", "amd64/mac", "oc.zip"},
{"Windows for x86_64", "amd64/windows", "oc.zip"},
{"Linux for ARM 64", "arm64/linux", "oc.tar"},
{"Linux for ARM 64 - RHEL 8", "arm64/linux", "oc.rhel8.tar"},
{"Linux for ARM 64 - RHEL 9", "arm64/linux", "oc.rhel9.tar"},
{"Mac for ARM 64", "arm64/mac", "oc.zip"},
{"Linux for IBM Power, little endian", "ppc64le/linux", "oc.tar"},
{"Linux for IBM Power, little endian - RHEL 8", "ppc64le/linux", "oc.rhel8.tar"},
{"Linux for IBM Power, little endian - RHEL 9", "ppc64le/linux", "oc.rhel9.tar"},
{"Linux for IBM Z", "s390x/linux", "oc.tar"},
{"Linux for IBM Z - RHEL 8", "s390x/linux", "oc.rhel8.tar"},
{"Linux for IBM Z - RHEL 9", "s390x/linux", "oc.rhel9.tar"},
}

links := []v1.CLIDownloadLink{}
Expand All @@ -205,7 +213,7 @@ func PlatformBasedOCConsoleCLIDownloads(host, cliDownloadsName string) *v1.Conso
Spec: v1.ConsoleCLIDownloadSpec{
Description: `With the OpenShift command line interface, you can create applications and manage OpenShift projects from a terminal.

The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features.
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.
`,
DisplayName: "oc - OpenShift Command Line Interface (CLI)",
Links: links,
Expand Down
34 changes: 33 additions & 1 deletion pkg/console/controllers/clidownloads/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,22 @@ func TestPlatformBasedOCConsoleCLIDownloads(t *testing.T) {
Spec: v1.ConsoleCLIDownloadSpec{
Description: `With the OpenShift command line interface, you can create applications and manage OpenShift projects from a terminal.

The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features.
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.
`,
DisplayName: "oc - OpenShift Command Line Interface (CLI)",
Links: []v1.CLIDownloadLink{
{
Href: "https://www.example.com/amd64/linux/oc.tar",
Text: "Download oc for Linux for x86_64",
},
{
Href: "https://www.example.com/amd64/linux/oc.rhel8.tar",
Text: "Download oc for Linux for x86_64 - RHEL 8",
},
{
Href: "https://www.example.com/amd64/linux/oc.rhel9.tar",
Text: "Download oc for Linux for x86_64 - RHEL 9",
},
{
Href: "https://www.example.com/amd64/mac/oc.zip",
Text: "Download oc for Mac for x86_64",
Expand All @@ -136,6 +144,14 @@ The oc binary offers the same capabilities as the kubectl binary, but it is furt
Href: "https://www.example.com/arm64/linux/oc.tar",
Text: "Download oc for Linux for ARM 64",
},
{
Href: "https://www.example.com/arm64/linux/oc.rhel8.tar",
Text: "Download oc for Linux for ARM 64 - RHEL 8",
},
{
Href: "https://www.example.com/arm64/linux/oc.rhel9.tar",
Text: "Download oc for Linux for ARM 64 - RHEL 9",
},
{
Href: "https://www.example.com/arm64/mac/oc.zip",
Text: "Download oc for Mac for ARM 64",
Expand All @@ -144,10 +160,26 @@ The oc binary offers the same capabilities as the kubectl binary, but it is furt
Href: "https://www.example.com/ppc64le/linux/oc.tar",
Text: "Download oc for Linux for IBM Power, little endian",
},
{
Href: "https://www.example.com/ppc64le/linux/oc.rhel8.tar",
Text: "Download oc for Linux for IBM Power, little endian - RHEL 8",
},
{
Href: "https://www.example.com/ppc64le/linux/oc.rhel9.tar",
Text: "Download oc for Linux for IBM Power, little endian - RHEL 9",
},
{
Href: "https://www.example.com/s390x/linux/oc.tar",
Text: "Download oc for Linux for IBM Z",
},
{
Href: "https://www.example.com/s390x/linux/oc.rhel8.tar",
Text: "Download oc for Linux for IBM Z - RHEL 8",
},
{
Href: "https://www.example.com/s390x/linux/oc.rhel9.tar",
Text: "Download oc for Linux for IBM Z - RHEL 9",
},
{
Href: "https://www.example.com/oc-license",
Text: "LICENSE",
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/downloads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func TestDownloadsEndpoint(t *testing.T) {
req := getRequest(t, link.Href)
client := getInsecureClient()
resp, err := client.Do(req)
t.Logf("Requesting %s at %s...", link.Text, link.Href)

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