From 6cf4a641c415c245361e0215cd75f19914330647 Mon Sep 17 00:00:00 2001 From: Nitishkumar Singh Date: Sat, 16 Mar 2024 19:28:24 +0530 Subject: [PATCH] add support for regctl Signed-off-by: Nitishkumar Singh --- README.md | 5 +++-- pkg/get/get_test.go | 50 +++++++++++++++++++++++++++++++++++++++++++++ pkg/get/tools.go | 28 +++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a185e86bd..58246eb9b 100644 --- a/README.md +++ b/README.md @@ -877,6 +877,7 @@ There are 56 apps that you can install on your cluster. | [popeye](https://github.com/derailed/popeye) | Scans live Kubernetes cluster and reports potential issues with deployed resources and configurations. | | [porter](https://github.com/getporter/porter) | With Porter you can package your application artifact, tools, etc. as a bundle that can distribute and install. | | [promtool](https://github.com/prometheus/prometheus) | Prometheus rule tester and debugging utility | +| [regctl](https://github.com/regclient/regclient) | Utility for accessing docker registries | | [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 | | [rpk](https://github.com/redpanda-data/redpanda) | Kafka compatible streaming platform for mission critical workloads. | @@ -892,7 +893,6 @@ There are 56 apps that you can install on your cluster. | [task](https://github.com/go-task/task) | A simple task runner and build tool | | [tctl](https://github.com/temporalio/tctl) | Temporal CLI. | | [terraform](https://github.com/hashicorp/terraform) | Infrastructure as Code for major cloud providers. | -| [opentofu](https://github.com/opentofu/opentofu) | OpenTofu lets you declaratively manage your cloud infrastructure. | | [terraform-docs](https://github.com/terraform-docs/terraform-docs) | Generate documentation from Terraform modules in various output formats. | | [terragrunt](https://github.com/gruntwork-io/terragrunt) | Terragrunt is a thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules | | [terrascan](https://github.com/tenable/terrascan) | Detect compliance and security violations across Infrastructure as Code. | @@ -901,6 +901,7 @@ There are 56 apps that you can install on your cluster. | [tilt](https://github.com/tilt-dev/tilt) | A multi-service dev environment for teams on Kubernetes. | | [timoni](https://github.com/stefanprodan/timoni) | A package manager for Kubernetes powered by CUE. | | [tkn](https://github.com/tektoncd/cli) | A CLI for interacting with Tekton. | +| [tofu](https://github.com/opentofu/opentofu) | OpenTofu lets you declaratively manage your cloud infrastructure | | [trivy](https://github.com/aquasecurity/trivy) | Vulnerability Scanner for Containers and other Artifacts, Suitable for CI. | | [vagrant](https://github.com/hashicorp/vagrant) | Tool for building and distributing development environments. | | [vault](https://github.com/hashicorp/vault) | A tool for secrets management, encryption as a service, and privileged access management. | @@ -910,6 +911,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 146 tools, use `arkade get NAME` to download one. +There are 151 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/get_test.go b/pkg/get/get_test.go index bd69e8dab..8a84fcca8 100644 --- a/pkg/get/get_test.go +++ b/pkg/get/get_test.go @@ -7149,3 +7149,53 @@ func Test_DownloadGPTScript(t *testing.T) { } } } + +func Test_DownloadRegCtl(t *testing.T) { + tools := MakeTools() + name := "regctl" + const version = "v0.5.7" + + tool := getTool(name, tools) + + tests := []test{ + { + os: "ming", + arch: arch64bit, + version: version, + url: `https://github.com/regclient/regclient/releases/download/v0.5.7/regctl-windows-amd64.exe`, + }, + { + os: "linux", + arch: arch64bit, + version: version, + url: `https://github.com/regclient/regclient/releases/download/v0.5.7/regctl-linux-amd64`, + }, + { + os: "linux", + arch: archARM64, + version: version, + url: `https://github.com/regclient/regclient/releases/download/v0.5.7/regctl-linux-arm64`, + }, + { + os: "darwin", + arch: arch64bit, + version: version, + url: `https://github.com/regclient/regclient/releases/download/v0.5.7/regctl-darwin-amd64`, + }, + { + os: "darwin", + arch: archDarwinARM64, + version: version, + url: `https://github.com/regclient/regclient/releases/download/v0.5.7/regctl-darwin-arm64`, + }, + } + 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) + } + } +} diff --git a/pkg/get/tools.go b/pkg/get/tools.go index 4dcd37caf..9bbab44eb 100644 --- a/pkg/get/tools.go +++ b/pkg/get/tools.go @@ -4118,5 +4118,33 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}} gptscript-{{.Version}}-{{$os}}-{{$arch}}.{{$ext}} `, }) + + tools = append(tools, + Tool{ + Owner: "regclient", + Repo: "regclient", + Name: "regctl", + Description: "Utility for accessing docker registries", + BinaryTemplate: ` + {{ $os := .OS }} + {{ $arch := .Arch }} + {{ $ext := "" }} + + {{- if eq .Arch "aarch64" -}} + {{$arch = "arm64"}} + {{- else if eq .Arch "arm64" -}} + {{ $arch = "arm64" }} + {{- else if eq .Arch "x86_64" -}} + {{ $arch = "amd64" }} + {{- end -}} + + {{ if HasPrefix .OS "ming" -}} + {{$os = "windows"}} + {{$ext = ".exe"}} + {{- end -}} + + regctl-{{$os}}-{{$arch}}{{$ext}} + `, + }) return tools }