devops-works / binenv

One binary to rule them all. Manage all those pesky binaries (kubectl, helm, terraform, ...) easily.
MIT License
372 stars 44 forks source link

adding yq #47

Closed deknos closed 3 years ago

deknos commented 3 years ago

adding yq

deknos commented 3 years ago

adding terraform-inventory as well. i use this in some schools for ansible inventory preparation

leucos commented 3 years ago

Hey @deknos

The URL for yq should be https://github.com/mikefarah/yq/releases/download/{{ .Version }}/yq_{{ .OS }}_{{ .Arch }}

For terraform-inventory, the release URL should be https://api.github.com/repos/adammck/terraform-inventory/releases while the download URL should be https://github.com/adammck/terraform-inventory/releases/download/v{{ .VersionMajor }}.{{ .VersionMinor }}/terraform-inventory_{{ .VersionMajor }}.{{ .VersionMinor }}_{{ .OS }}_{{ .Arch }}.zip

The later is a bit tricky since it is not using SerVer. Thus we have to use individual version components in the URL template.

deknos commented 3 years ago

thanks for the headsup! i will adapt the files. and thanks for the versioning hint!

deknos commented 3 years ago

sadly i will only able to do that in the evening

leucos commented 3 years ago

sadly i will only able to do that in the evening

no problem, take it easy

deknos commented 3 years ago

i added it regarding your suggestions! :)

leucos commented 3 years ago

We're almost there. For terraform-inventory, the release URL should be https://api.github.com/repos/adammck/terraform-inventory/release (therepos part is missing)

You can test your changes easily:

deknos commented 3 years ago

i tested it in a vagrant box: vagrant@debian10:~$ binenv update terraform-inventory updating distributions 100% |████████████████████████████████████████████| (1/1, 19880 it/s) 2020-11-25T10:56:09Z ERR error unmarshalling github response for https://api.github.com/adammck/terraform-inventory/releases error="json: cannot unmarshal object into Go value of type list.ghReleaseResponse" func=GithubRelease.Get 2020-11-25T10:56:09Z ERR unable to fetch versions for "terraform-inventory" error="json: cannot unmarshal object into Go value of type list.ghReleaseResponse"

i shortened the progressbar, but the rest is copied verbatim. Any idea what's the problem?

deknos commented 3 years ago

after 20:00 localtime i can try to have a look into the code, earlier won't work.

leucos commented 3 years ago

i tested it in a vagrant box: vagrant@debian10:~$ binenv update terraform-inventory updating distributions 100% |████████████████████████████████████████████| (1/1, 19880 it/s) 2020-11-25T10:56:09Z ERR error unmarshalling github response for https://api.github.com/adammck/terraform-inventory/releases error="json: cannot unmarshal object into Go value of type list.ghReleaseResponse" func=GithubRelease.Get 2020-11-25T10:56:09Z ERR unable to fetch versions for "terraform-inventory" error="json: cannot unmarshal object into Go value of type list.ghReleaseResponse"

i shortened the progressbar, but the rest is copied verbatim. Any idea what's the problem?

Yes, see https://github.com/devops-works/binenv/pull/47#issuecomment-733599710 and https://github.com/devops-works/binenv/pull/47#issuecomment-732433162 :D

You use the wrong URL. The proper one is https://api.github.com/repos/adammck/terraform-inventory/releases

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest"
}

vs.

 curl https://api.github.com/repos/adammck/terraform-inventory/releases 
[
  {
    "url": "https://api.github.com/repos/adammck/terraform-inventory/releases/19151645",
    "assets_url": "https://api.github.com/repos/adammck/terraform-inventory/releases/19151645/assets",
    "upload_url": "https://uploads.github.com/repos/adammck/terraform-inventory/releases/19151645/assets{?name,label}",
    "html_url": "https://github.com/adammck/terraform-inventory/releases/tag/v0.9",
    "id": 19151645,
    "author": {
      "login": "adammck",
   ...
deknos commented 3 years ago

... arg. i will fix it.

deknos commented 3 years ago

done. i surely oversaw that.

deknos commented 3 years ago

and i updated and installed succesfully <3

leucos commented 3 years ago

Awesome, thanks !!