This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/pkg/alpha.dagger.io/kubernetes/helm/code.cue
Andrea Luzzardi 282759c0e5 cue modules: move stdlib to pkg/alpha.dagger.io
In preparation for Europa, we will vendor multiple CUE modules:

- `pkg/alpha.dagger.io`: legacy non-europa packages
- `pkg/dagger.io`: core Europa packages
- `pkg/universe.dagger.io`: Europa universe

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2022-01-11 13:16:37 -08:00

44 lines
1.1 KiB
CUE

package helm
#code: #"""
# Add the repository
if [ -n "$HELM_REPO" ]; then
helm repo add repository "${HELM_REPO}"
helm repo update
fi
# If the chart is a file, then it's the chart name
# If it's a directly, then it's the contents of the cart
if [ -f "/helm/chart" ]; then
HELM_CHART="repository/$(cat /helm/chart)"
else
HELM_CHART="/helm/chart"
fi
OPTS=""
OPTS="$OPTS --timeout "$HELM_TIMEOUT""
OPTS="$OPTS --namespace "$KUBE_NAMESPACE""
[ "$HELM_WAIT" = "true" ] && OPTS="$OPTS --wait"
[ "$HELM_ATOMIC" = "true" ] && OPTS="$OPTS --atomic"
[ -f "/helm/values.yaml" ] && OPTS="$OPTS -f /helm/values.yaml"
# Select the namespace
kubectl create namespace "$KUBE_NAMESPACE" || true
case "$HELM_ACTION" in
install)
helm install $OPTS "$HELM_NAME" "$HELM_CHART"
;;
upgrade)
helm upgrade $OPTS "$HELM_NAME" "$HELM_CHART"
;;
installOrUpgrade)
helm upgrade $OPTS --install "$HELM_NAME" "$HELM_CHART"
;;
*)
echo unsupported helm action "$HELM_ACTION"
exit 1
;;
esac
"""#