From b8766b45b249f328046d80fd2464d51dac03e57f Mon Sep 17 00:00:00 2001 From: Richard Gee Date: Sat, 26 Oct 2024 08:41:37 +0100 Subject: [PATCH] feat: add crossplane CLI (crank) to tools Signed-off-by: Richard Gee --- README.md | 4 ++- pkg/get/get_test.go | 59 +++++++++++++++++++++++++++++++++++++++++++++ pkg/get/tools.go | 26 ++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 77d2392d9..0c594040e 100644 --- a/README.md +++ b/README.md @@ -783,6 +783,7 @@ There are 52 apps that you can install on your cluster. | [cr](https://github.com/helm/chart-releaser) | Hosting Helm Charts via GitHub Pages and Releases | | [crane](https://github.com/google/go-containerregistry) | crane is a tool for interacting with remote images and registries | | [croc](https://github.com/schollz/croc) | Easily and securely send things from one computer to another | +| [crossplane](https://github.com/crossplane/crossplane) | Simplify some development and administration aspects of Crossplane. | | [dagger](https://github.com/dagger/dagger) | A portable devkit for CI/CD pipelines. | | [devspace](https://github.com/devspace-sh/devspace) | Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes. | | [dive](https://github.com/wagoodman/dive) | A tool for exploring each layer in a docker image | @@ -915,6 +916,7 @@ There are 52 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 157 tools, use `arkade get NAME` to download one. + +There are 158 tools, use `arkade get NAME` to download one. > Note to contributors, run `go build && ./arkade get --format markdown` to generate this list \ No newline at end of file diff --git a/pkg/get/get_test.go b/pkg/get/get_test.go index e243a63d7..ddccee391 100644 --- a/pkg/get/get_test.go +++ b/pkg/get/get_test.go @@ -7961,3 +7961,62 @@ func Test_Download_duplik8s(t *testing.T) { } } } + +func Test_Crossplane(t *testing.T) { + tools := MakeTools() + name := "crossplane" + + tool := getTool(name, tools) + + const toolVersion = "v1.17.2" + + tests := []test{ + { + os: "darwin", + arch: arch64bit, + version: toolVersion, + url: `https://releases.crossplane.io/stable/v1.17.2/bin/darwin_amd64/crank`, + }, + { + os: "darwin", + arch: archDarwinARM64, + version: toolVersion, + url: `https://releases.crossplane.io/stable/v1.17.2/bin/darwin_arm64/crank`, + }, + { + os: "linux", + arch: arch64bit, + version: toolVersion, + url: `https://releases.crossplane.io/stable/v1.17.2/bin/linux_amd64/crank`, + }, + { + os: "linux", + arch: archARM64, + version: toolVersion, + url: `https://releases.crossplane.io/stable/v1.17.2/bin/linux_arm64/crank`, + }, + { + os: "linux", + arch: archARM7, + version: toolVersion, + url: `https://releases.crossplane.io/stable/v1.17.2/bin/linux_arm/crank`, + }, + { + os: "ming", + arch: arch64bit, + version: toolVersion, + url: `https://releases.crossplane.io/stable/v1.17.2/bin/windows_amd64/crank.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\ngot: %s", tc.url, got) + } + } + +} diff --git a/pkg/get/tools.go b/pkg/get/tools.go index 8b38c331e..0cb22a857 100644 --- a/pkg/get/tools.go +++ b/pkg/get/tools.go @@ -4327,5 +4327,31 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Name}} duplik8s_{{$os}}_{{$arch}}.{{$ext}} `, }) + tools = append(tools, + Tool{ + Owner: "crossplane", + Repo: "crossplane", + Name: "crossplane", + VersionStrategy: GitHubVersionStrategy, + Description: "Simplify some development and administration aspects of Crossplane.", + URLTemplate: ` + {{$arch := .Arch}} + {{$ext := "" }} + {{- if (or (eq .Arch "x86_64") (eq .Arch "amd64")) -}} + {{$arch = "amd64"}} + {{- else if (or (eq .Arch "aarch64") (eq .Arch "arm64")) -}} + {{$arch = "arm64"}} + {{- else if eq .Arch "armv7l" -}} + {{ $arch = "arm" }} + {{- end -}} + + {{$os := .OS}} + {{ if HasPrefix .OS "ming" -}} + {{$ext = ".exe" }} + {{$os = "windows"}} + {{- end -}} + + https://releases.crossplane.io/stable/{{.Version}}/bin/{{$os}}_{{$arch}}/crank{{$ext}}`, + }) return tools }