diff --git a/pkg/get/get_test.go b/pkg/get/get_test.go index c46f5eac2..f3d2ca7ab 100644 --- a/pkg/get/get_test.go +++ b/pkg/get/get_test.go @@ -1237,6 +1237,64 @@ func Test_DownloadK9s(t *testing.T) { } } +func Test_DownloadPopeye(t *testing.T) { + tools := MakeTools() + name := "popeye" + + tool := getTool(name, tools) + + const toolVersion = "v0.21.2" + + tests := []test{ + { + os: "ming", + arch: arch64bit, + version: toolVersion, + url: "https://github.com/derailed/popeye/releases/download/" + toolVersion + "/popeye_Windows_amd64.tar.gz", + }, + { + os: "linux", + arch: arch64bit, + version: toolVersion, + url: "https://github.com/derailed/popeye/releases/download/" + toolVersion + "/popeye_Linux_amd64.tar.gz", + }, + { + os: "darwin", + arch: arch64bit, + version: toolVersion, + url: "https://github.com/derailed/popeye/releases/download/" + toolVersion + "/popeye_Darwin_amd64.tar.gz", + }, + { + os: "darwin", + arch: archDarwinARM64, + version: toolVersion, + url: "https://github.com/derailed/popeye/releases/download/" + toolVersion + "/popeye_Darwin_arm64.tar.gz", + }, + { + os: "linux", + arch: archARM64, + version: toolVersion, + url: "https://github.com/derailed/popeye/releases/download/" + toolVersion + "/popeye_Linux_arm64.tar.gz", + }, + { + os: "linux", + arch: archARM7, + version: toolVersion, + url: "https://github.com/derailed/popeye/releases/download/" + toolVersion + "/popeye_Linux_armv7.tar.gz", + }, + } + + 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) + } + } +} + func Test_DownloadEtcd(t *testing.T) { tools := MakeTools() name := "etcd" @@ -6762,20 +6820,32 @@ func Test_DownloadAtuin(t *testing.T) { tool := getTool(name, tools) - const toolVersion = "v15.0.0" + const toolVersion = "v18.2.0" tests := []test{ + { + os: "darwin", + arch: archDarwinARM64, + version: toolVersion, + url: "https://github.com/atuinsh/atuin/releases/download/" + toolVersion + "/atuin-" + toolVersion + "-aarch64-apple-darwin.tar.gz", + }, + { + os: "linux", + arch: archARM64, + version: toolVersion, + url: "https://github.com/atuinsh/atuin/releases/download/" + toolVersion + "/atuin-" + toolVersion + "-aarch64-unknown-linux-gnu.tar.gz", + }, { os: "linux", arch: arch64bit, version: toolVersion, - url: `https://github.com/atuinsh/atuin/releases/download/v15.0.0/atuin-v15.0.0-x86_64-unknown-linux-gnu.tar.gz`, + url: "https://github.com/atuinsh/atuin/releases/download/" + toolVersion + "/atuin-" + toolVersion + "-x86_64-unknown-linux-gnu.tar.gz", }, { os: "darwin", arch: arch64bit, version: toolVersion, - url: `https://github.com/atuinsh/atuin/releases/download/v15.0.0/atuin-v15.0.0-x86_64-apple-darwin.tar.gz`, + url: "https://github.com/atuinsh/atuin/releases/download/" + toolVersion + "/atuin-" + toolVersion + "-x86_64-apple-darwin.tar.gz", }, } @@ -6785,7 +6855,7 @@ func Test_DownloadAtuin(t *testing.T) { t.Fatal(err) } if got != tc.url { - t.Errorf("want: %s, got: %s", tc.url, got) + t.Errorf("\nwant: %s, \n got: %s", tc.url, got) } } diff --git a/pkg/get/tools.go b/pkg/get/tools.go index fa24225d2..518d17274 100644 --- a/pkg/get/tools.go +++ b/pkg/get/tools.go @@ -779,6 +779,8 @@ https://github.com/inlets/inletsctl/releases/download/{{.Version}}/{{$fileName}} {{ $arch = "arm64" }} {{- else if eq .Arch "x86_64" -}} {{ $arch = "amd64" }} + {{- else if eq .Arch "armv7l" -}} + {{ $arch = "armv7" }} {{- end -}} {{.Version}}/{{.Name}}_{{ $os }}_{{ $arch }}.tar.gz`, @@ -819,11 +821,11 @@ https://github.com/inlets/inletsctl/releases/download/{{.Version}}/{{$fileName}} tools = append(tools, Tool{ - Owner: "hashicorp", - Repo: "terraform", - Name: "terraform", - Version: "1.7.4", - Description: "Infrastructure as Code for major cloud providers.", + Owner: "hashicorp", + Repo: "terraform", + Name: "terraform", + VersionStrategy: GitHubVersionStrategy, + Description: "Infrastructure as Code for major cloud providers.", URLTemplate: ` {{$arch := ""}} {{- if eq .Arch "x86_64" -}} @@ -841,7 +843,7 @@ https://github.com/inlets/inletsctl/releases/download/{{.Version}}/{{$fileName}} {{$os = "windows"}} {{- end -}} - https://releases.hashicorp.com/{{.Name}}/{{.Version}}/{{.Name}}_{{.Version}}_{{$os}}_{{$arch}}.zip`, + https://releases.hashicorp.com/{{.Name}}/{{.VersionNumber}}/{{.Name}}_{{.VersionNumber}}_{{$os}}_{{$arch}}.zip`, }) tools = append(tools, @@ -959,16 +961,16 @@ https://github.com/inlets/inletsctl/releases/download/{{.Version}}/{{$fileName}} tools = append(tools, Tool{ - Owner: "hashicorp", - Repo: "packer", - Name: "packer", - Version: "1.10.1", - Description: "Build identical machine images for multiple platforms from a single source configuration.", + Owner: "hashicorp", + Repo: "packer", + Name: "packer", + VersionStrategy: GitHubVersionStrategy, + Description: "Build identical machine images for multiple platforms from a single source configuration.", URLTemplate: ` {{$arch := ""}} {{- if eq .Arch "x86_64" -}} {{$arch = "amd64"}} - {{- else if eq .Arch "aarch64" -}} + {{- else if or (eq .Arch "aarch64") (eq .Arch "arm64") -}} {{$arch = "arm64"}} {{- else if eq .Arch "armv7l" -}} {{$arch = "arm"}} @@ -979,16 +981,16 @@ https://github.com/inlets/inletsctl/releases/download/{{.Version}}/{{$fileName}} {{$os = "windows"}} {{- end -}} - https://releases.hashicorp.com/{{.Name}}/{{.Version}}/{{.Name}}_{{.Version}}_{{$os}}_{{$arch}}.zip`, + https://releases.hashicorp.com/{{.Name}}/{{.VersionNumber}}/{{.Name}}_{{.VersionNumber}}_{{$os}}_{{$arch}}.zip`, }) tools = append(tools, Tool{ - Owner: "hashicorp", - Repo: "waypoint", - Name: "waypoint", - Version: "0.11.4", - Description: "Easy application deployment for Kubernetes and Amazon ECS", + Owner: "hashicorp", + Repo: "waypoint", + Name: "waypoint", + VersionStrategy: GitHubVersionStrategy, + Description: "Easy application deployment for Kubernetes and Amazon ECS", URLTemplate: ` {{$arch := .Arch}} {{- if eq .Arch "x86_64" -}} @@ -1004,7 +1006,7 @@ https://github.com/inlets/inletsctl/releases/download/{{.Version}}/{{$fileName}} {{$os = "windows"}} {{- end -}} - https://releases.hashicorp.com/{{.Name}}/{{.Version}}/{{.Name}}_{{.Version}}_{{$os}}_{{$arch}}.zip`}) + https://releases.hashicorp.com/{{.Name}}/{{.VersionNumber}}/{{.Name}}_{{.VersionNumber}}_{{$os}}_{{$arch}}.zip`}) tools = append(tools, Tool{ @@ -2954,11 +2956,11 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}} tools = append(tools, Tool{ - Owner: "hashicorp", - Repo: "vault", - Name: "vault", - Version: "1.11.2", - Description: "A tool for secrets management, encryption as a service, and privileged access management.", + Owner: "hashicorp", + Repo: "vault", + Name: "vault", + VersionStrategy: GitHubVersionStrategy, + Description: "A tool for secrets management, encryption as a service, and privileged access management.", URLTemplate: ` {{$arch := ""}} {{- if eq .Arch "x86_64" -}} @@ -2976,7 +2978,7 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}} {{$os = "windows"}} {{- end -}} - https://releases.hashicorp.com/{{.Name}}/{{.Version}}/{{.Name}}_{{.Version}}_{{$os}}_{{$arch}}.zip`, + https://releases.hashicorp.com/{{.Name}}/{{.VersionNumber}}/{{.Name}}_{{.VersionNumber}}_{{$os}}_{{$arch}}.zip`, }) tools = append(tools, @@ -3831,6 +3833,8 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}} {{- if (or (eq .Arch "x86_64") (eq .Arch "amd64")) -}} {{$arch = "x86_64"}} + {{- else if (or (eq .Arch "aarch64") (eq .Arch "arm64")) -}} + {{$arch = "aarch64"}} {{- end -}} https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Name}}-{{.Version}}-{{$arch}}-{{$os}}.{{$ext}}`,