alexellis / arkade

Open Source Marketplace For Developer Tools
https://blog.alexellis.io/kubernetes-marketplace-two-year-update/
MIT License
4.25k stars 289 forks source link

Add consul as a tool & fix tests #1071

Closed rgee0 closed 6 months ago

rgee0 commented 6 months ago

Description

Adds hashicorp/consul as a tool with associated tests Amends template pattern for hashicorp/terraform to simplify and align with the consul template pattern Addresses a comment on a previous PR where the project preference is for URLs in the tests to not use variable concatenation

Motivation and Context

How Has This Been Tested?

Functional get consul

➜  arkade git:(consul) ✗ go build && ./arkade get consul
Downloading: consul
2024/05/14 19:13:33 Looking up version for consul
2024/05/14 19:13:33 Found: v1.18.1
Downloading: https://releases.hashicorp.com/consul/1.18.1/consul_1.18.1_darwin_amd64.zip
64.41 MiB / 64.41 MiB [---------------------------------------------------------------------------------------------] 100.00%
/var/folders/3w/tv6429v51kl_61rd1fr25sgm0000gq/T/arkade-2590627787/consul_1.18.1_darwin_amd64.zip written.
Name: consul_1.18.1_darwin_amd64.zip, size: 675408822024/05/14 19:13:43 Extracted: /var/folders/3w/tv6429v51kl_61rd1fr25sgm0000gq/T/arkade-2590627787/consul
2024/05/14 19:13:43 Copying /var/folders/3w/tv6429v51kl_61rd1fr25sgm0000gq/T/arkade-2590627787/consul to /Users/rgee0/.arkade/bin/consul

Wrote: /Users/rgee0/.arkade/bin/consul (178.1MB)

make e2e

➜  arkade git:(consul) make e2e
...
PASS
coverage: 61.3% of statements
ok      github.com/alexellis/arkade/pkg/get     17.057s coverage: 61.3% of statements

test-tool.sh

➜  arkade git:(consul) ✗ go build && ./hack/test-tool.sh consul
+ ./arkade get consul --arch arm64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/consul
/Users/rgee0/.arkade/bin/consul: Mach-O 64-bit executable arm64
+ rm /Users/rgee0/.arkade/bin/consul
+ echo

+ ./arkade get consul --arch x86_64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/consul
/Users/rgee0/.arkade/bin/consul: Mach-O 64-bit executable x86_64
+ rm /Users/rgee0/.arkade/bin/consul
+ echo

+ ./arkade get consul --arch x86_64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/consul
/Users/rgee0/.arkade/bin/consul: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=y5LPp24ZZhNnDP284ubb/2BIXzozfTq_kUytkGCR7/0uYO--iYavJs7FCS1rvQ/KQCEHNg-3xt9aIm_DlAy, with debug_info, not stripped
+ rm /Users/rgee0/.arkade/bin/consul
+ echo

+ ./arkade get consul --arch aarch64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/consul
/Users/rgee0/.arkade/bin/consul: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=p55ha8vtSDvMG4eStmHP/5lcKf2QXYh8prK4_NqLY/d85FIYQ7fWuz8kMAaBkH/GB7aLtoLOjvYic5drpH4, with debug_info, not stripped
+ rm /Users/rgee0/.arkade/bin/consul
+ echo

+ ./arkade get consul --arch x86_64 --os mingw --quiet
+ file /Users/rgee0/.arkade/bin/consul.exe
/Users/rgee0/.arkade/bin/consul.exe: PE32+ executable (console) x86-64, for MS Windows
+ rm /Users/rgee0/.arkade/bin/consul.exe
+ echo

bonus test-tool for armv7l

./arkade get consul --arch armv7l --os linux --quiet && file $HOME/.arkade/bin/consul && rm $HOME/.arkade/bin/consul && echo 

/Users/rgee0/.arkade/bin/consul: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, Go BuildID=38Zg_JvFEG_WciKC899U/wZdCM6Xix5dMFk9MsL53/uI_WAboiEkoZv5DFYo3v/89zw3nPirkldgp4ozMf5, with debug_info, not stripped

test-tool terraform

➜  arkade git:(consul) ✗ go build && ./hack/test-tool.sh terraform           
+ ./arkade get terraform --arch arm64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/terraform
/Users/rgee0/.arkade/bin/terraform: Mach-O 64-bit executable arm64
+ rm /Users/rgee0/.arkade/bin/terraform
+ echo

+ ./arkade get terraform --arch x86_64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/terraform
/Users/rgee0/.arkade/bin/terraform: Mach-O 64-bit executable x86_64
+ rm /Users/rgee0/.arkade/bin/terraform
+ echo

+ ./arkade get terraform --arch x86_64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/terraform
/Users/rgee0/.arkade/bin/terraform: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=CpQmWceVi6IG07QhDVDA/-PNr21IQMN6lBUo_oYNE/b1jkmskH-RIPSk7op7z7/ymMG1spInI3R34m3YFWU, stripped
+ rm /Users/rgee0/.arkade/bin/terraform
+ echo

+ ./arkade get terraform --arch aarch64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/terraform
/Users/rgee0/.arkade/bin/terraform: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=q2B1pSQ4KezkSCDw_rEx/EseGQP_fMgTQCLgE7Knn/zZ7dIputq3WkbGQSV71Y/gBhf2m1vUTB6XpcZEOJm, stripped
+ rm /Users/rgee0/.arkade/bin/terraform
+ echo

+ ./arkade get terraform --arch x86_64 --os mingw --quiet
+ file /Users/rgee0/.arkade/bin/terraform.exe
/Users/rgee0/.arkade/bin/terraform.exe: PE32+ executable (console) x86-64, for MS Windows
+ rm /Users/rgee0/.arkade/bin/terraform.exe
+ echo

Types of changes

Documentation

Checklist: