Skip to content

Commit 260fa9d

Browse files
committed
Add age / age-keygen
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent 2c3669e commit 260fa9d

File tree

3 files changed

+159
-0
lines changed

3 files changed

+159
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ There are 53 apps that you can install on your cluster.
762762

763763
| TOOL | DESCRIPTION |
764764
|------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
765+
| [age](https://github.com/FiloSottile/age) | A simple, modern and secure file encryption tool. |
765766
| [actions-usage](https://github.com/self-actuated/actions-usage) | Get usage insights from GitHub Actions. |
766767
| [actuated-cli](https://github.com/self-actuated/actuated-cli) | Official CLI for actuated.dev |
767768
| [alloy](https://github.com/grafana/alloy) | OpenTelemetry Collector distribution with programmable pipelines |

pkg/get/get_test.go

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9292,3 +9292,109 @@ func Test_LogCLI(t *testing.T) {
92929292
})
92939293
}
92949294
}
9295+
9296+
func Test_DownloadAge(t *testing.T) {
9297+
tools := MakeTools()
9298+
name := "age"
9299+
const version = "v1.3.1"
9300+
9301+
tool := getTool(name, tools)
9302+
9303+
tests := []test{
9304+
{
9305+
os: "linux",
9306+
arch: arch64bit,
9307+
version: version,
9308+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-linux-amd64.tar.gz`,
9309+
},
9310+
{
9311+
os: "linux",
9312+
arch: archARM64,
9313+
version: version,
9314+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-linux-arm64.tar.gz`,
9315+
},
9316+
{
9317+
os: "darwin",
9318+
arch: arch64bit,
9319+
version: version,
9320+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-darwin-amd64.tar.gz`,
9321+
},
9322+
{
9323+
os: "darwin",
9324+
arch: archDarwinARM64,
9325+
version: version,
9326+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-darwin-arm64.tar.gz`,
9327+
},
9328+
{
9329+
os: "ming",
9330+
arch: arch64bit,
9331+
version: version,
9332+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-windows-amd64.zip`,
9333+
},
9334+
}
9335+
9336+
for _, tc := range tests {
9337+
t.Run(fmt.Sprintf("Download for: %s %s %s", tc.os, tc.arch, tc.version), func(r *testing.T) {
9338+
got, _, err := tool.GetURL(tc.os, tc.arch, tc.version, false)
9339+
if err != nil {
9340+
t.Fatal(err)
9341+
}
9342+
if got != tc.url {
9343+
t.Errorf("\nwant: %s\ngot: %s", tc.url, got)
9344+
}
9345+
})
9346+
}
9347+
}
9348+
9349+
func Test_DownloadAgeKeygen(t *testing.T) {
9350+
tools := MakeTools()
9351+
name := "age-keygen"
9352+
const version = "v1.3.1"
9353+
9354+
tool := getTool(name, tools)
9355+
9356+
tests := []test{
9357+
{
9358+
os: "linux",
9359+
arch: arch64bit,
9360+
version: version,
9361+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-linux-amd64.tar.gz`,
9362+
},
9363+
{
9364+
os: "linux",
9365+
arch: archARM64,
9366+
version: version,
9367+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-linux-arm64.tar.gz`,
9368+
},
9369+
{
9370+
os: "darwin",
9371+
arch: arch64bit,
9372+
version: version,
9373+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-darwin-amd64.tar.gz`,
9374+
},
9375+
{
9376+
os: "darwin",
9377+
arch: archDarwinARM64,
9378+
version: version,
9379+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-darwin-arm64.tar.gz`,
9380+
},
9381+
{
9382+
os: "ming",
9383+
arch: arch64bit,
9384+
version: version,
9385+
url: `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-windows-amd64.zip`,
9386+
},
9387+
}
9388+
9389+
for _, tc := range tests {
9390+
t.Run(fmt.Sprintf("Download for: %s %s %s", tc.os, tc.arch, tc.version), func(r *testing.T) {
9391+
got, _, err := tool.GetURL(tc.os, tc.arch, tc.version, false)
9392+
if err != nil {
9393+
t.Fatal(err)
9394+
}
9395+
if got != tc.url {
9396+
t.Errorf("\nwant: %s\ngot: %s", tc.url, got)
9397+
}
9398+
})
9399+
}
9400+
}

pkg/get/tools.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5079,5 +5079,57 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/dyff_{{.V
50795079
https://github.com/grafana/loki/releases/download/{{.Version}}/{{.Name}}-{{$os}}-{{$arch}}.{{$ext}}`,
50805080
})
50815081

5082+
tools = append(tools,
5083+
Tool{
5084+
Owner: "FiloSottile",
5085+
Repo: "age",
5086+
Name: "age",
5087+
Description: "A simple, modern, and secure file encryption tool.",
5088+
BinaryTemplate: `
5089+
{{$os := ""}}
5090+
{{$ext := "tar.gz"}}
5091+
{{ if HasPrefix .OS "ming" -}}
5092+
{{$os = "windows"}}
5093+
{{$ext = "zip"}}
5094+
{{- else if eq .OS "linux" -}}
5095+
{{$os = "linux"}}
5096+
{{- else if eq .OS "darwin" -}}
5097+
{{$os = "darwin"}}
5098+
{{- end -}}
5099+
{{$arch := .Arch}}
5100+
{{- if eq .Arch "x86_64" -}}
5101+
{{$arch = "amd64"}}
5102+
{{- else if (or (eq .Arch "aarch64") (eq .Arch "arm64")) -}}
5103+
{{$arch = "arm64"}}
5104+
{{- end -}}
5105+
{{.Name}}-{{.Version}}-{{$os}}-{{$arch}}.{{$ext}}`,
5106+
})
5107+
5108+
tools = append(tools,
5109+
Tool{
5110+
Owner: "FiloSottile",
5111+
Repo: "age",
5112+
Name: "age-keygen",
5113+
Description: "Key generation tool for age encryption.",
5114+
BinaryTemplate: `
5115+
{{$os := ""}}
5116+
{{$ext := "tar.gz"}}
5117+
{{ if HasPrefix .OS "ming" -}}
5118+
{{$os = "windows"}}
5119+
{{$ext = "zip"}}
5120+
{{- else if eq .OS "linux" -}}
5121+
{{$os = "linux"}}
5122+
{{- else if eq .OS "darwin" -}}
5123+
{{$os = "darwin"}}
5124+
{{- end -}}
5125+
{{$arch := .Arch}}
5126+
{{- if eq .Arch "x86_64" -}}
5127+
{{$arch = "amd64"}}
5128+
{{- else if (or (eq .Arch "aarch64") (eq .Arch "arm64")) -}}
5129+
{{$arch = "arm64"}}
5130+
{{- end -}}
5131+
age-{{.Version}}-{{$os}}-{{$arch}}.{{$ext}}`,
5132+
})
5133+
50825134
return tools
50835135
}

0 commit comments

Comments
 (0)