Repository: alexellis/arkade (Go)

Issue:
Add kube-score
Include [kube-score](https://github.com/zegl/kube-score) in arkade. This would allow us to use it as part of our CICD pipeline to verify our kubernetes resources via the `arkade-get` Github workflow action.

## Expected Behaviour
Similar to any other tool – `kube-score: latest` would be great, plus support to point it to specific versions.

## Possible Solution
`kube-score` is a Golang program, so statically built, therefore should be comparatively simple to add support for, I hope.

## Context
Currently I have to use a less popular, "random" Github Action to install `kube-score` (because we're migrating from another CI system I want to keep existing functionality). I'd much prefer to be able to use arkade / arkade-get for this since we already found it useful for other tools. :grin: 

## If requesting a CLI for "arkade get"

How many downloads does this tool have? [523,480](https://somsubhra.github.io/github-release-stats/?username=zegl&repository=kube-score&page=1&per_page=5)

If approved, are you willing to submit a pull request for this? Sorry, no, no time currently.


Discussion:
This has been added by @rgee0, thanks @xamino for the suggestion.



Patch:
diff --git a/README.md b/README.md
index 2e7de42c0..d8cecbc57 100644
--- a/README.md
+++ b/README.md
@@ -838,6 +838,7 @@ There are 56 apps that you can install on your cluster.
 | [kube-bench](https://github.com/aquasecurity/kube-bench)                     | Checks whether Kubernetes is deployed securely by running the checks documented in the CIS Kubernetes Benchmark.                                                |
 | [kube-burner](https://github.com/cloud-bulldozer/kube-burner)                | A tool aimed at stressing Kubernetes clusters by creating or deleting a high quantity of objects.                                                               |
 | [kube-linter](https://github.com/stackrox/kube-linter)                       | KubeLinter is a static analysis tool that checks Kubernetes YAML files and Helm charts to ensure the applications represented in them adhere to best practices. |
+| [kube-score](https://github.com/zegl/kube-score)                             | A tool that performs static code analysis of your Kubernetes object definitions.                                                                                |
 | [kubebuilder](https://github.com/kubernetes-sigs/kubebuilder)                | Framework for building Kubernetes APIs using custom resource definitions (CRDs).                                                                                |
 | [kubecm](https://github.com/sunny0826/kubecm)                                | Easier management of kubeconfig.                                                                                                                                |
 | [kubeconform](https://github.com/yannh/kubeconform)                          | A FAST Kubernetes manifests validator, with support for Custom Resources                                                                                        |
@@ -912,6 +913,6 @@ There are 56 apps that you can install on your cluster.
 | [waypoint](https://github.com/hashicorp/waypoint)                            | Easy application deployment for Kubernetes and Amazon ECS                                                                                                       |
 | [yq](https://github.com/mikefarah/yq)                                        | Portable command-line YAML processor.                                                                                                                           |
 | [yt-dlp](https://github.com/yt-dlp/yt-dlp)                                   | Fork of youtube-dl with additional features and fixes                                                                                                           |
-There are 152 tools, use `arkade get NAME` to download one.
+There are 153 tools, use `arkade get NAME` to download one.
 
 > Note to contributors, run `arkade get --format markdown` to generate this list
diff --git a/pkg/get/tools.go b/pkg/get/tools.go
index cb97527fa..fa24225d2 100644
--- a/pkg/get/tools.go
+++ b/pkg/get/tools.go
@@ -4168,5 +4168,30 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}}
 					`,
 		})
 
+	tools = append(tools,
+		Tool{
+			Owner:       "zegl",
+			Repo:        "kube-score",
+			Name:        "kube-score",
+			Description: "A tool that performs static code analysis of your Kubernetes object definitions.",
+			BinaryTemplate: `
+			{{$os := .OS}}
+			{{$arch := .Arch}}
+			{{$ext := "tar.gz"}}
+
+			{{- if HasPrefix .OS "ming" -}}
+			{{ $os = "windows" }}
+			{{ $ext = "exe" }}
+		{{- end -}}
+
+			{{- if (or (eq .Arch "aarch64") (eq .Arch "arm64")) -}}
+				{{$arch = "arm64"}}
+			{{- else if eq .Arch "x86_64" -}}
+				{{ $arch = "amd64" }}
+			{{- end -}}
+
+			{{.Name}}_{{.VersionNumber}}_{{$os}}_{{$arch}}.{{$ext}}`,
+		})
+
 	return tools
 }


Test patch:
diff --git a/pkg/get/get_test.go b/pkg/get/get_test.go
index e7fa3a8c7..c46f5eac2 100644
--- a/pkg/get/get_test.go
+++ b/pkg/get/get_test.go
@@ -7400,3 +7400,62 @@ func Test_DownloadFaasd(t *testing.T) {
 		}
 	}
 }
+
+func Test_DownloadKubeScore(t *testing.T) {
+	tools := MakeTools()
+	name := "kube-score"
+
+	tool := getTool(name, tools)
+
+	const toolVersion = "v1.18.0"
+
+	tests := []test{
+		{
+			os:      "linux",
+			arch:    arch64bit,
+			version: toolVersion,
+			url:     "https://github.com/zegl/kube-score/releases/download/v1.18.0/kube-score_1.18.0_linux_amd64.tar.gz",
+		},
+		{
+			os:      "darwin",
+			arch:    arch64bit,
+			version: toolVersion,
+			url:     "https://github.com/zegl/kube-score/releases/download/v1.18.0/kube-score_1.18.0_darwin_amd64.tar.gz",
+		},
+		{
+			os:      "linux",
+			arch:    archARM64,
+			version: toolVersion,
+			url:     "https://github.com/zegl/kube-score/releases/download/v1.18.0/kube-score_1.18.0_linux_arm64.tar.gz",
+		},
+		{
+			os:      "darwin",
+			arch:    archDarwinARM64,
+			version: toolVersion,
+			url:     "https://github.com/zegl/kube-score/releases/download/v1.18.0/kube-score_1.18.0_darwin_arm64.tar.gz",
+		},
+		{
+			os:      "ming",
+			arch:    archARM64,
+			version: toolVersion,
+			url:     "https://github.com/zegl/kube-score/releases/download/v1.18.0/kube-score_1.18.0_windows_arm64.exe",
+		},
+		{
+			os:      "ming",
+			arch:    arch64bit,
+			version: toolVersion,
+			url:     "https://github.com/zegl/kube-score/releases/download/v1.18.0/kube-score_1.18.0_windows_amd64.exe",
+		},
+	}
+
+	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("\nwant: %s, \n got: %s", tc.url, got)
+		}
+	}
+
+}