Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves issue #951 by adding support for the Red Hat OpenShift on AWS (rosa) cli tool #966

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Could you regenerate the table? There must be one more line with the changed numbers of tools.

| [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. |
Expand Down
40 changes: 40 additions & 0 deletions pkg/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are missing a few tests here for different archs. e.g. https://github.com/alexellis/arkade/blob/master/pkg/get/get_test.go#L6467

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"
Expand Down
35 changes: 35 additions & 0 deletions pkg/get/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Comment on lines +3691 to +3697
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch is not being used in the template, why do we need it?


{{- 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",
Expand Down