Skip to content

Commit

Permalink
fix installation steps
Browse files Browse the repository at this point in the history
  • Loading branch information
gdecicco committed Apr 21, 2024
1 parent 1ab9d55 commit 3ca57fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
19 changes: 7 additions & 12 deletions bin/exec-env
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
#!/usr/bin/env bash

# Environment Variables available to script

# ASDF_INSTALL_TYPE: version or ref
# ASDF_INSTALL_VERSION:
# Full version number if ASDF_INSTALL_TYPE=version.
# Git ref (tag/commit/branch) if ASDF_INSTALL_TYPE=ref.
# ASDF_INSTALL_PATH: The path to where the tool has been, or should be installed.

# Commands that invoke this script

# asdf which <command>: Display the path to an executable
# asdf exec <command> [args...]: Executes the command shim for current version
# asdf env <command> [util]: Runs util (default: env) inside the environment used for command shim execution.

setup_helm_plugin_usage() {
helm plugin uninstall secrets >>/dev/null 2>&1 || true
ln -s "${ASDF_INSTALL_PATH}/bin" $(helm env HELM_PLUGINS)/helm-secrets
}
set -euo pipefail

current_script_path=${BASH_SOURCE[0]}
plugin_dir=$(dirname "$(dirname "$current_script_path")")

# shellcheck source=./lib/utils.bash
source "${plugin_dir}/lib/utils.bash"

setup_helm_plugin_usage
11 changes: 7 additions & 4 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ list_github_tags() {
}

list_all_versions() {
# TODO: Adapt this. By default we simply list the tag names from GitHub releases.
# Change this function if helm-secrets has other means of determining installable versions.
list_github_tags
}

Expand All @@ -41,13 +39,17 @@ download_release() {
version="$1"
filename="$2"

# TODO: Adapt the release URL convention for helm-secrets
url="$GH_REPO/archive/v${version}.tar.gz"

echo "* Downloading $TOOL_NAME release $version..."
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
}

setup_helm_plugin_usage() {
helm plugin uninstall secrets >>/dev/null 2>&1 || true
ln -s "${ASDF_INSTALL_PATH}/bin" "$(helm env HELM_PLUGINS)/helm-secrets"
}

install_version() {
local install_type="$1"
local version="$2"
Expand All @@ -61,11 +63,12 @@ install_version() {
mkdir -p "$install_path"
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"

# TODO: Assert helm-secrets executable exists.
local tool_cmd
tool_cmd="scripts/run.sh"
test -x "$install_path/$tool_cmd" || fail "Expected $install_path/$tool_cmd to be executable."

setup_helm_plugin_usage

echo "$TOOL_NAME $version installation was successful!"
) || (
rm -rf "$install_path"
Expand Down

0 comments on commit 3ca57fd

Please sign in to comment.