Skip to content

Commit

Permalink
Add M1 version for minikube
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Gee <richard@technologee.co.uk>
  • Loading branch information
rgee0 authored and alexellis committed Jun 13, 2022
1 parent 613830d commit aab83cd
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 13 deletions.
62 changes: 62 additions & 0 deletions pkg/get/get_test.go
Expand Up @@ -1468,6 +1468,68 @@ func Test_getBinaryURL_NoSlashInDownloadPath(t *testing.T) {
}
}

func Test_DownloadMinikube(t *testing.T) {
tools := MakeTools()
name := "minikube"

tool := getTool(name, tools)

tests := []test{
{
os: "ming",
arch: "amd64",
version: "v1.25.2",
url: `https://github.com/kubernetes/minikube/releases/download/v1.25.2/minikube-windows-amd64.exe`,
},
{
os: "linux",
arch: "amd64",
version: "v1.25.2",
url: `https://github.com/kubernetes/minikube/releases/download/v1.25.2/minikube-linux-amd64`,
},
{
os: "linux",
arch: archARM64,
version: "v1.25.2",
url: `https://github.com/kubernetes/minikube/releases/download/v1.25.2/minikube-linux-arm64`,
},
{
os: "linux",
arch: "armv6l",
version: "v1.25.2",
url: `https://github.com/kubernetes/minikube/releases/download/v1.25.2/minikube-linux-armv6`,
},
{
os: "linux",
arch: archARM7,
version: "v1.25.2",
url: `https://github.com/kubernetes/minikube/releases/download/v1.25.2/minikube-linux-arm`,
},
{
os: "darwin",
arch: "amd64",
version: "v1.25.2",
url: `https://github.com/kubernetes/minikube/releases/download/v1.25.2/minikube-darwin-amd64`,
},
{
os: "darwin",
arch: archARM64,
version: "v1.25.2",
url: `https://github.com/kubernetes/minikube/releases/download/v1.25.2/minikube-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)
}
}
}

func Test_DownloadMinio(t *testing.T) {
tools := MakeTools()
name := "mc"
Expand Down
39 changes: 26 additions & 13 deletions pkg/get/tools.go
Expand Up @@ -944,19 +944,32 @@ https://releases.hashicorp.com/{{.Name}}/{{.Version}}/{{.Name}}_{{.Version}}_{{$
Repo: "minikube",
Name: "minikube",
Description: "Runs the latest stable release of Kubernetes, with support for standard Kubernetes features.",
BinaryTemplate: `{{ if HasPrefix .OS "ming" -}}
{{.Name}}-windows-amd64.exe
{{- else if eq .OS "darwin" -}}
{{.Name}}-darwin-amd64
{{- else if eq .Arch "armv6l" -}}
{{.Name}}-linux-arm
{{- else if eq .Arch "armv7l" -}}
{{.Name}}-linux-arm
{{- else if eq .Arch "aarch64" -}}
{{.Name}}-linux-arm64
{{- else -}}
{{.Name}}-linux-amd64
{{- end -}}`,
BinaryTemplate: `{{$arch := .Arch}}
{{ if eq .Arch "x86_64" -}}
{{$arch = "amd64"}}
{{- else if eq .Arch "armv6l" -}}
{{$arch = "armv6"}}
{{- else if eq .Arch "armv7l" -}}
{{$arch = "arm"}}
{{- else if eq .Arch "aarch64" -}}
{{$arch = "arm64"}}
{{- end -}}
{{$osStr := ""}}
{{ if HasPrefix .OS "ming" -}}
{{$osStr = "windows"}}
{{- else if eq .OS "linux" -}}
{{$osStr = "linux"}}
{{- else if eq .OS "darwin" -}}
{{$osStr = "darwin"}}
{{- end -}}
{{$ext := ""}}
{{ if HasPrefix .OS "ming" -}}
{{$ext = ".exe"}}
{{- end -}}
{{.Version}}/{{.Name}}-{{$osStr}}-{{$arch}}{{$ext}}`,
})

tools = append(tools,
Expand Down

0 comments on commit aab83cd

Please sign in to comment.