Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "cel"
version: "3.0.1"
version: "3.0.2"
usage: "Validate Helm values using CEL expressions"
description: |-
A Helm plugin to validate values.yaml using CEL expressions defined in values.cel.yaml.
Expand Down
120 changes: 76 additions & 44 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,93 @@ set -e

# Development mode: skip download if env var is set
if [ -n "$HELM_CEL_PLUGIN_NO_INSTALL_HOOK" ]; then
echo "Development mode: not downloading versioned release."
exit 0
echo "Development mode: not downloading versioned release."
exit 0
fi

# Get version from plugin.yaml (assumes version: "x.y.z" is present)
VERSION=$(grep '^version:' plugin.yaml | cut -d '"' -f 2)
if [ -n "$HELM_CEL_PLUGIN_VERSION" ]; then
# Development mode: version override
echo "Development mode: overrinding VERSION with ${HELM_CEL_PLUGIN_VERSION}."
VERSION="$HELM_CEL_PLUGIN_VERSION"
else
# Get version from plugin.yaml (assumes version: "x.y.z" is present)
VERSION=$(grep '^version:' plugin.yaml | cut -d '"' -f 2)
fi
echo "VERSION: ${VERSION}"

# Detect OS
OS=""
case "$(uname -s)" in
Darwin)
OS="Darwin"
;;
Linux)
OS="Linux"
;;
MINGW*|MSYS*|CYGWIN*|Windows_NT)
OS="Windows"
;;
*)
echo "Unsupported OS: $(uname -s)"
exit 1
;;
esac
if [ -n "$HELM_CEL_PLUGIN_OS" ]; then
# Development mode: OS override
echo "Development mode: overrinding OS with ${HELM_CEL_PLUGIN_OS}."
OS="$HELM_CEL_PLUGIN_OS"
else
# Detect OS
OS=""
case "$(uname -s)" in
Darwin)
OS="Darwin"
;;
Linux)
OS="Linux"
;;
MINGW* | MSYS* | CYGWIN* | Windows_NT)
OS="Windows"
;;
*)
echo "Unsupported OS: $(uname -s)"
exit 1
;;
esac
fi
echo "OS: ${OS}"

# Detect ARCH
ARCH=""
case "$(uname -m)" in
x86_64)
ARCH="amd64"
;;
aarch64|arm64)
ARCH="arm64"
;;
armv6*)
ARCH="armv6"
;;
armv7*)
ARCH="armv7"
;;
*)
echo "Failed to detect target architecture: $(uname -m)"
exit 1
;;
esac
if [ -n "$HELM_CEL_PLUGIN_ARCH" ]; then
# Development mode: ARCH override
echo "Development mode: overrinding ARCH with ${HELM_CEL_PLUGIN_ARCH}."
ARCH="$HELM_CEL_PLUGIN_ARCH"
else
# Detect ARCH
ARCH=""
case "$(uname -m)" in
x86_64)
ARCH="x86_64"
;;
aarch64 | arm64)
ARCH="arm64"
;;
armv6*)
ARCH="armv6"
;;
armv7*)
ARCH="armv7"
;;
*)
echo "Failed to detect target architecture: $(uname -m)"
exit 1
;;
esac
fi
echo "ARCH: ${ARCH}"

ARCHIVE="helm-cel_${VERSION}_${OS}_${ARCH}"
if [ "$OS" = "Windows" ]; then
ARCHIVE="${ARCHIVE}.zip"
ARCHIVE="${ARCHIVE}.zip"
else
ARCHIVE="${ARCHIVE}.tar.gz"
ARCHIVE="${ARCHIVE}.tar.gz"
fi
echo "ARCHIVE: ${ARCHIVE}"

if [ -n "$HELM_CEL_PLUGIN_DIR" ]; then
# Development mode: DIR override
echo "Development mode: overrinding DIR with ${HELM_CEL_PLUGIN_DIR}."
HELM_PLUGIN_DIR="$HELM_CEL_PLUGIN_DIR"
fi
if [ -z "$HELM_PLUGIN_DIR" ]; then
HELM_PLUGIN_DIR="${HELM_PLUGIN_HOME:-$HOME/.local/share/helm/plugins}/helm-cel"
fi
echo "DIR: ${HELM_PLUGIN_DIR}"

URL="https://github.com/idsulik/helm-cel/releases/download/v${VERSION}/${ARCHIVE}"
echo "Downloading $URL"
echo "URL: ${URL}"

# Clean and create bin directory
rm -rf "$HELM_PLUGIN_DIR/bin"
Expand Down
Loading