Skip to content

Instantly share code, notes, and snippets.

@caarlos0
Created April 4, 2019 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caarlos0/8560a0520994b56e16449f492c27781c to your computer and use it in GitHub Desktop.
Save caarlos0/8560a0520994b56e16449f492c27781c to your computer and use it in GitHub Desktop.
#!/bin/sh
set -ex
TAR_FILE="/tmp/kubeval.tar.gz"
RELEASES_URL="https://github.com/garethr/kubeval/releases"
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)"
last_version() {
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" |
rev |
cut -f1 -d'/'|
rev
}
download() {
test -z "$VERSION" && VERSION="$(last_version)"
test -z "$VERSION" && {
echo "Unable to get kubeval version." >&2
exit 1
}
rm -f "$TAR_FILE"
os="linux"
test "$(uname -s)" = "Darwin" && os="darwin"
curl -s -L -o "$TAR_FILE" \
"$RELEASES_URL/download/$VERSION/kubeval-${os}-amd64.tar.gz"
}
download
mkdir -p .bin
tar -xf "$TAR_FILE" -C .bin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment