diff options
| author | Nick Khyl <nickk@tailscale.com> | 2024-12-05 13:16:48 -0600 |
|---|---|---|
| committer | Nick Khyl <nickk@tailscale.com> | 2024-12-05 13:16:48 -0600 |
| commit | 0267fe83b200f1702a2fa0a395442c02a053fadb (patch) | |
| tree | 63654c55225eeb834de59a5a0bc8d19033c6145b /tool/helm | |
| parent | 87546a5edf6b6503a87eeb2d666baba57398a066 (diff) | |
| download | tailscale-1.78.0.tar.xz tailscale-1.78.0.zip | |
VERSION.txt: this is v1.78.0v1.78.0
Signed-off-by: Nick Khyl <nickk@tailscale.com>
Diffstat (limited to 'tool/helm')
| -rwxr-xr-x | tool/helm | 138 |
1 files changed, 69 insertions, 69 deletions
@@ -1,69 +1,69 @@ -#!/usr/bin/env bash - -# installs $(cat ./helm.rev) version of helm as $HOME/.cache/tailscale-helm - -set -euo pipefail - -if [[ "${CI:-}" == "true" ]]; then - set -x -fi - -( - if [[ "${CI:-}" == "true" ]]; then - set -x - fi - - repo_root="${BASH_SOURCE%/*}/../" - cd "$repo_root" - - cachedir="$HOME/.cache/tailscale-helm" - tarball="${cachedir}.tar.gz" - - read -r want_rev < "$(dirname "$0")/helm.rev" - - got_rev="" - if [[ -x "${cachedir}/helm" ]]; then - got_rev=$("${cachedir}/helm" version --short) - got_rev="${got_rev#v}" # trim the leading 'v' - got_rev="${got_rev%+*}" # trim the trailing '+" followed by a commit SHA' - - - fi - - if [[ "$want_rev" != "$got_rev" ]]; then - rm -rf "$cachedir" "$tarball" - if [[ -n "${IN_NIX_SHELL:-}" ]]; then - nix_helm="$(which -a helm | grep /nix/store | head -1)" - nix_helm="${nix_helm%/helm}" - nix_helm_rev="${nix_helm##*-}" - if [[ "$nix_helm_rev" != "$want_rev" ]]; then - echo "Wrong helm version in Nix, got $nix_helm_rev want $want_rev" >&2 - exit 1 - fi - ln -sf "$nix_helm" "$cachedir" - else - # works for linux and darwin - # https://github.com/helm/helm/releases - OS=$(uname -s | tr A-Z a-z) - ARCH=$(uname -m) - if [ "$ARCH" = "x86_64" ]; then - ARCH="amd64" - fi - if [ "$ARCH" = "aarch64" ]; then - ARCH="arm64" - fi - mkdir -p "$cachedir" - # When running on GitHub in CI, the below curl sometimes fails with - # INTERNAL_ERROR after finishing the download. The most common cause - # of INTERNAL_ERROR is glitches in intermediate hosts handling of - # HTTP/2 forwarding, so forcing HTTP 1.1 often fixes the issue. See - # https://github.com/tailscale/tailscale/issues/8988 - curl -f -L --http1.1 -o "$tarball" -sSL "https://get.helm.sh/helm-v${want_rev}-${OS}-${ARCH}.tar.gz" - (cd "$cachedir" && tar --strip-components=1 -xf "$tarball") - rm -f "$tarball" - fi - fi -) - -export PATH="$HOME/.cache/tailscale-helm:$PATH" -exec "$HOME/.cache/tailscale-helm/helm" "$@" +#!/usr/bin/env bash
+
+# installs $(cat ./helm.rev) version of helm as $HOME/.cache/tailscale-helm
+
+set -euo pipefail
+
+if [[ "${CI:-}" == "true" ]]; then
+ set -x
+fi
+
+(
+ if [[ "${CI:-}" == "true" ]]; then
+ set -x
+ fi
+
+ repo_root="${BASH_SOURCE%/*}/../"
+ cd "$repo_root"
+
+ cachedir="$HOME/.cache/tailscale-helm"
+ tarball="${cachedir}.tar.gz"
+
+ read -r want_rev < "$(dirname "$0")/helm.rev"
+
+ got_rev=""
+ if [[ -x "${cachedir}/helm" ]]; then
+ got_rev=$("${cachedir}/helm" version --short)
+ got_rev="${got_rev#v}" # trim the leading 'v'
+ got_rev="${got_rev%+*}" # trim the trailing '+" followed by a commit SHA'
+
+
+ fi
+
+ if [[ "$want_rev" != "$got_rev" ]]; then
+ rm -rf "$cachedir" "$tarball"
+ if [[ -n "${IN_NIX_SHELL:-}" ]]; then
+ nix_helm="$(which -a helm | grep /nix/store | head -1)"
+ nix_helm="${nix_helm%/helm}"
+ nix_helm_rev="${nix_helm##*-}"
+ if [[ "$nix_helm_rev" != "$want_rev" ]]; then
+ echo "Wrong helm version in Nix, got $nix_helm_rev want $want_rev" >&2
+ exit 1
+ fi
+ ln -sf "$nix_helm" "$cachedir"
+ else
+ # works for linux and darwin
+ # https://github.com/helm/helm/releases
+ OS=$(uname -s | tr A-Z a-z)
+ ARCH=$(uname -m)
+ if [ "$ARCH" = "x86_64" ]; then
+ ARCH="amd64"
+ fi
+ if [ "$ARCH" = "aarch64" ]; then
+ ARCH="arm64"
+ fi
+ mkdir -p "$cachedir"
+ # When running on GitHub in CI, the below curl sometimes fails with
+ # INTERNAL_ERROR after finishing the download. The most common cause
+ # of INTERNAL_ERROR is glitches in intermediate hosts handling of
+ # HTTP/2 forwarding, so forcing HTTP 1.1 often fixes the issue. See
+ # https://github.com/tailscale/tailscale/issues/8988
+ curl -f -L --http1.1 -o "$tarball" -sSL "https://get.helm.sh/helm-v${want_rev}-${OS}-${ARCH}.tar.gz"
+ (cd "$cachedir" && tar --strip-components=1 -xf "$tarball")
+ rm -f "$tarball"
+ fi
+ fi
+)
+
+export PATH="$HOME/.cache/tailscale-helm:$PATH"
+exec "$HOME/.cache/tailscale-helm/helm" "$@"
|
