Skip to content

Commit

Permalink
Add butane tool to arkade
Browse files Browse the repository at this point in the history
Signed-off-by: Czékus Máté <mate@picloud.hu>
  • Loading branch information
Shikachuu authored and alexellis committed Sep 3, 2022
1 parent 8ae2109 commit 3965bae
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -583,6 +583,7 @@ There are 56 apps that you can install on your cluster.
| autok3s | Run Rancher Lab's lightweight Kubernetes distribution k3s everywhere. |
| buildx | Docker CLI plugin for extended build capabilities with BuildKit. |
| bun | Bun is an incredibly fast JavaScript runtime, bundler, transpiler and package manager – all in one. |
| butane | Translates human readable Butane Configs into machine readable Ignition Configs |
| caddy | Caddy is an extensible server platform that uses TLS by default |
| cilium | CLI to install, manage & troubleshoot Kubernetes clusters running Cilium. |
| civo | CLI for interacting with your Civo resources. |
Expand Down Expand Up @@ -680,6 +681,6 @@ There are 56 apps that you can install on your cluster.
| waypoint | Easy application deployment for Kubernetes and Amazon ECS |
| yq | Portable command-line YAML processor. |

There are 102 tools, use `arkade get NAME` to download one.
There are 103 tools, use `arkade get NAME` to download one.

> Note to contributors, run `arkade get --output markdown` to generate this list
47 changes: 47 additions & 0 deletions pkg/get/get_test.go
Expand Up @@ -4784,3 +4784,50 @@ func Test_DownloadHadolint(t *testing.T) {
})
}
}

func Test_DownloadButane(t *testing.T) {
tools := MakeTools()
name := "butane"
version := "v0.15.0"

tool := getTool(name, tools)

tests := []test{
{
os: "darwin",
arch: arch64bit,
version: version,
url: "https://github.com/coreos/butane/releases/download/v0.15.0/butane-x86_64-apple-darwin",
},
{
os: "linux",
arch: arch64bit,
version: version,
url: "https://github.com/coreos/butane/releases/download/v0.15.0/butane-x86_64-unknown-linux-gnu",
},
{
os: "linux",
arch: archARM64,
version: version,
url: "https://github.com/coreos/butane/releases/download/v0.15.0/butane-aarch64-unknown-linux-gnu",
},
{
os: "ming",
arch: arch64bit,
version: version,
url: "https://github.com/coreos/butane/releases/download/v0.15.0/butane-x86_64-pc-windows-gnu.exe",
},
}

for _, tc := range tests {
t.Run(tc.os+" "+tc.arch+" "+tc.version, func(r *testing.T) {
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)
}
})
}
}
2 changes: 1 addition & 1 deletion pkg/get/table.go
Expand Up @@ -20,7 +20,7 @@ func CreateToolsTable(tools Tools, format TableFormat) {
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Tool", "Description"})
table.SetCaption(true,
fmt.Sprintf("There are %d tools, use 'arkade get NAME' to download one.", len(tools)))
fmt.Sprintf("There are %d tools, use `arkade get NAME` to download one.", len(tools)))
if format == MarkdownStyle {
table.SetCaption(true)
table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
Expand Down
26 changes: 26 additions & 0 deletions pkg/get/tools.go
Expand Up @@ -2752,5 +2752,31 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Name}}
`,
})

tools = append(tools,
Tool{
Owner: "coreos",
Repo: "butane",
Name: "butane",
Description: "Translates human readable Butane Configs into machine readable Ignition Configs",
BinaryTemplate: `
{{$os := ""}}
{{$ext := ""}}
{{$arch := .Arch}}
{{- if eq .OS "linux" -}}
{{$os = "unknown-linux-gnu"}}
{{- else if eq .OS "darwin" -}}
{{$os = "apple-darwin"}}
{{- else if HasPrefix .OS "ming" -}}
{{$os = "pc-windows-gnu"}}
{{$ext = ".exe"}}
{{- end -}}
{{- if eq .Arch "arm64" -}}
{{$arch = "aarch64"}}
{{- end -}}
{{.Name}}-{{$arch}}-{{$os}}{{$ext}}
`,
})

return tools
}

0 comments on commit 3965bae

Please sign in to comment.