Kustomize: Failed to install 0.9.4 binary

Created on 11 Nov 2020  Â·  12Comments  Â·  Source: kubernetes-sigs/kustomize

Describe the bug


I'm running this command to install the latest binary while it throws an error:

✗ curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"  | bash
Error: kustomize binary with the version 0.9.4 does not exist!

Expected output
Installs Kustomize binary successfully.

Platform
macOS

kinbug triagunresolved

All 12 comments

We are doing a release today. Please check back later.

@Shell32-Natsu Thanks for the response!

How can I install a specific version with one line command?

Put the version number, say v3.8.6, as an argument for install_kustomize.sh.

Yes, I tried the following but got:

✗ curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh v0.9.3" | bash
bash: line 1: Bad: command not found

Seemed to be an invalid command?

+1

@realshuting Try this curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s 3.8.6

Worked thanks!

Assuming you have curl, jq and a version of grep that supports Perl-like regex, the following work for me to fix a failing CI build:

latest=$(curl -sL https://api.github.com/repos/kubernetes-sigs/kustomize/git/refs/tags/kustomize | jq '.[-1].ref' | grep -Po '\d+\.\d+\.\d+')
curl -sLO "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
bash ./install_kustomize.sh $latest

The issue is the latest GitHub "_release_" is for kyaml so the version does not exist for kustomize.
The above example is getting a tag list from the GitHub API, grabbing the last element with jq, and then parsing out the version with grep (from refs/tags/kustomize/v<version>). It does appear the GitHub API always returns a sorted list of tag refs.

Add to it - grep -Po '\d+\.\d+\.\d+' does not work for me, changed the first command to grep -Eo '\d+\.\d+\.\d+ and now everything works.

latest=$(curl -sL https://api.github.com/repos/kubernetes-sigs/kustomize/git/refs/tags/kustomize | jq '.[-1].ref' | grep -Eo '\d+\.\d+\.\d+')
curl -sLO "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
bash ./install_kustomize.sh $latest

Output:

{Version:kustomize/v3.8.6 GitCommit:c1747439cd8bc956028ad483cdb30d9273c18b24 BuildDate:2020-10-29T23:13:15Z GoOs:darwin GoArch:amd64}
kustomize installed to current directory.

Add to it - grep -Po '\d+\.\d+\.\d+' does not work for me, changed the first command to grep -Eo '\d+\.\d+\.\d+ and now everything works.

latest=$(curl -sL https://api.github.com/repos/kubernetes-sigs/kustomize/git/refs/tags/kustomize | jq '.[-1].ref' | grep -Eo '\d+\.\d+\.\d+')
curl -sLO "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
bash ./install_kustomize.sh $latest

Output:

{Version:kustomize/v3.8.6 GitCommit:c1747439cd8bc956028ad483cdb30d9273c18b24 BuildDate:2020-10-29T23:13:15Z GoOs:darwin GoArch:amd64}
kustomize installed to current directory.

I think the "Extended" regex in grep normally doesn't handle \d, except maybe on OSX (maybe BSD in general). On most linux distributions you'd need to use: grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' (which will also work on OSX).

Yes I'm on macOS, your suggestion really solved my case!

Was this page helpful?
0 / 5 - 0 ratings