From 6daea3c481bf3165f64ca125cb169687ee85bc6c Mon Sep 17 00:00:00 2001 From: gangadharjannu Date: Sun, 14 Aug 2022 01:18:38 +0200 Subject: [PATCH] Replaces wget with cURL Adds os detection using OSTYPE environment variable Adds latest yq version detection using GitHub API Updates spacing and indentation --- plugin.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugin.yaml b/plugin.yaml index 5aa47cc..02fa0d8 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -13,12 +13,18 @@ # limitations under the License. Name: "release" -version: "0.3.0" +version: "0.3.1" usage: "pull or update Helm Releases" description: |- Update values of a releases, pull charts from releases command: "$HELM_PLUGIN_DIR/release.sh" hooks: - install: | - wget https://github.com/mikefarah/yq/releases/download/v4.25.3/yq_linux_amd64 -O $HELM_PLUGIN_DIR/lib/yq; - chmod +x $HELM_PLUGIN_DIR/lib/yq; \ No newline at end of file + install: | + VERSION=$(curl --silent "https://api.github.com/repos/mikefarah/yq/releases/latest" | jq -r .tag_name) + case "$OSTYPE" in + darwin*) BINARY="yq_darwin_amd64" ;; + linux*) BINARY="yq_linux_amd64" ;; + *) printf '%s\n' "Unsupported operating system detected while installing yq." >&2;exit 1 ;; + esac + curl -L https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -o $HELM_PLUGIN_DIR/lib/yq; + chmod +x $HELM_PLUGIN_DIR/lib/yq;