From 60ebdd456b787b4e871502ae215a50c9c38897df Mon Sep 17 00:00:00 2001 From: Matt Kimberley Date: Thu, 3 Aug 2023 09:43:02 +0100 Subject: [PATCH] Resolves issue #951 by adding support for the Red Hat OpenShift on AWS (rosa) cli tool Signed-off-by: Matt Kimberley --- README.md | 1 + pkg/get/get_test.go | 40 ++++++++++++++++++++++++++++++++++++++++ pkg/get/tools.go | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/README.md b/README.md index bb9ffcc38..c635a9357 100644 --- a/README.md +++ b/README.md @@ -836,6 +836,7 @@ There are 56 apps that you can install on your cluster. | [promtool](https://github.com/prometheus/prometheus) | Prometheus rule tester and debugging utility | | [rekor-cli](https://github.com/sigstore/rekor) | Secure Supply Chain - Transparency Log | | [replicated](https://github.com/replicatedhq/replicated) | CLI for interacting with the Replicated Vendor API | +| [rosa](https://github.com/openshift/rosa) | Red Hat OpenShift on AWS (ROSA) command line tool | | [rpk](https://github.com/redpanda-data/redpanda) | Kafka compatible streaming platform for mission critical workloads. | | [run-job](https://github.com/alexellis/run-job) | Run a Kubernetes Job and get the logs when it's done. | | [scaleway-cli](https://github.com/scaleway/scaleway-cli) | Scaleway CLI is a tool to help you pilot your Scaleway infrastructure directly from your terminal. | diff --git a/pkg/get/get_test.go b/pkg/get/get_test.go index 51c039d49..9c9ad2a83 100644 --- a/pkg/get/get_test.go +++ b/pkg/get/get_test.go @@ -6350,6 +6350,46 @@ func Test_DownloadOpenshiftCLI(t *testing.T) { } } +func Test_DownloadRosaCLI(t *testing.T) { + tools := MakeTools() + name := "rosa" + + tool := getTool(name, tools) + + const toolVersion = "1.2.23" + + tests := []test{ + { + os: "linux", + arch: arch64bit, + version: toolVersion, + url: `https://mirror.openshift.com/pub/openshift-v4/clients/rosa/1.2.23/rosa-linux.tar.gz`, + }, + { + os: "darwin", + arch: arch64bit, + version: toolVersion, + url: `https://mirror.openshift.com/pub/openshift-v4/clients/rosa/1.2.23/rosa-macosx.tar.gz`, + }, + { + os: "ming", + arch: arch64bit, + version: toolVersion, + url: `https://mirror.openshift.com/pub/openshift-v4/clients/rosa/1.2.23/rosa-windows.zip`, + }, + } + + for _, tc := range tests { + got, err := tool.GetURL(tc.os, tc.arch, tc.version, false) + if err != nil { + t.Fatal(err) + } + if got != tc.url { + t.Errorf("want: %s, got: %s", tc.url, got) + } + } +} + func Test_DownloadAtuin(t *testing.T) { tools := MakeTools() name := "atuin" diff --git a/pkg/get/tools.go b/pkg/get/tools.go index b683b3400..35be80554 100644 --- a/pkg/get/tools.go +++ b/pkg/get/tools.go @@ -3669,6 +3669,41 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}} `, }) + tools = append(tools, + Tool{ + Owner: "redhat", + Repo: "rosa", + Name: "rosa", + Description: "Red Hat OpenShift on AWS (ROSA) command line tool", + URLTemplate: ` + {{$os := .OS}} + {{$arch := .Arch}} + {{$ext := "tar.gz"}} + {{$version := .VersionNumber}} + + {{- if eq .OS "darwin" -}} + {{$os = "macosx"}} + {{- else if HasPrefix .OS "ming" -}} + {{$os = "windows"}} + {{$ext = "zip"}} + {{- end -}} + + {{- if eq .Arch "aarch64" -}} + {{$arch = "-arm64"}} + {{- else if eq .Arch "arm64" -}} + {{ $arch = "-arm64" }} + {{- else if eq .Arch "x86_64" -}} + {{ $arch = "" }} + {{- end -}} + + {{- if eq .VersionNumber "" -}} + {{$version = "latest"}} + {{- end -}} + + https://mirror.openshift.com/pub/openshift-v4/clients/rosa/{{$version}}/rosa-{{$os}}.{{$ext}} + `, + }) + tools = append(tools, Tool{ Owner: "atuinsh",