Skip to content

Commit

Permalink
per @dweomer, update build-chart script to fail correctly if specifie…
Browse files Browse the repository at this point in the history
…d version does not exist

Signed-off-by: Brian Downs <[email protected]>
  • Loading branch information
briandowns committed Sep 10, 2020
1 parent 28655a3 commit 1361a32
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions charts/build-chart.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
#!/usr/bin/env bash

set -eux -o pipefail

: "${CHART_FILE?required}"
: "${CHART_NAME:="$(basename "${CHART_FILE%%-chart.yml}")"}"
: "${CHART_URL:="${CHART_REPO:="https://rke2-charts.rancher.io"}/assets/${CHART_NAME}/${CHART_NAME}-${CHART_VERSION:="v0.0.0"}.tgz"}"
curl -fsSL "${CHART_URL}" -o "${CHART_TMP:=$(mktemp)}"
cat <<-EOF > "${CHART_FILE}"
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: "${CHART_NAME:="$(basename "${CHART_FILE%%-chart.yml}")"}"
name: "${CHART_NAME}"
namespace: "${CHART_NAMESPACE:="kube-system"}"
annotations:
helm.cattle.io/chart-url: "${CHART_URL:="${CHART_REPO:="https://rke2-charts.rancher.io"}/assets/${CHART_NAME}/${CHART_NAME}-${CHART_VERSION:="v0.0.0"}.tgz"}"
helm.cattle.io/chart-url: "${CHART_URL}"
spec:
bootstrap: ${CHART_BOOTSTRAP:=false}
chartContent: $(curl -fsSL "${CHART_URL}" | base64 -w0)
chartContent: $(base64 -w0 < "${CHART_TMP}")
EOF

0 comments on commit 1361a32

Please sign in to comment.