Skip to content

Commit

Permalink
fix install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
joelee2012 committed Dec 30, 2024
1 parent 5260ba1 commit e3fe446
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func newRootCmd(version string) *cobra.Command {
var clean = Clean{}
var rootCmd = &cobra.Command{
Use: "clean",
Short: "A helm plugin to clean release by date",
Long: `A helm plugin to clean release by date
Short: "A helm plugin to list/clean out of date releases",
Long: `A helm plugin to list/clean out of date releases
Clean/List the release which was updated before duration
List/Clean the release which was not updated in duration
Examples:
# List all release which was updated before 240h
# List all release which was not updated in 240h
helm clean -A -b 240h
# List release which was created by chart that matched chart-1
Expand Down
12 changes: 6 additions & 6 deletions install-binary.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/usr/bin/env sh
# this was copied from [email protected]:databus23/helm-diff
cd $HELM_PLUGIN_DIR
set -e
if [ "$HELM_DEBUG" = true ]; then
set -x
env | sort
fi

REPO_URL=$(git remote get-url origin)
PROJECT_NAME=${HELM_PLUGIN_DIR##*/}
PROJECT_GH=$(echo "${REPO_URL##*:}" | sed -r 's!.git$!!g')
PROJECT_GH=$(echo "${REPO_URL}" | awk -F'/' '{print $4"/"$5}' | sed -r 's!\.git$!!g')
export GREP_COLOR="never"

# Convert HELM_BIN and HELM_PLUGIN_DIR to unix if cygpath is
Expand Down Expand Up @@ -84,7 +86,7 @@ downloadFile() {
echo "Either curl or wget is required"
exit 1
fi
version=$(git -C "$HELM_PLUGIN_DIR" describe --tags --exact-match 2>/dev/null | sed 's/^v//g' || :)
version=$(git describe --tags --exact-match 2>/dev/null | sed 's/^v//g' || :)
if [ "$SCRIPT_MODE" = "install" ] && [ -n "$version" ]; then
DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/download/v$version/${PROJECT_NAME}_${version}_${OS}_${ARCH}.tar.gz"
else
Expand All @@ -110,24 +112,22 @@ exit_trap() {
rmTempDir
if [ "$result" != "0" ]; then
echo "Failed to install $PROJECT_NAME"
printf '\tFor support, go to ${REPO_URL}.\n'
echo "For support, go to ${REPO_URL}."
fi
exit $result
}

# testVersion tests the installed client to make sure it is working.
testVersion() {
set +e
echo "${PROJECT_NAME} installed into $HELM_PLUGIN_DIR"
"$HELM_BIN" "$HELM_PLUGIN_NAME" -h
set -e
}

# Execution

#Stop execution on any error
trap "exit_trap" EXIT
set -e

initArch
initOS
mkTempDir
Expand Down
7 changes: 3 additions & 4 deletions plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: "clean"
version: "0.5.0"
usage: "plugin to clean no updated release"
description: "plugin to clean no updated release"
platformCommand:
- command: "$HELM_PLUGIN_DIR/helm-clean"
usage: "List/Clean out of date releases"
description: "List/Clean out of date releases"
command: "$HELM_PLUGIN_DIR/helm-clean"
hooks:
install: "$HELM_PLUGIN_DIR/install-binary.sh"
update: "$HELM_PLUGIN_DIR/install-binary.sh -u"

0 comments on commit e3fe446

Please sign in to comment.