#!/usr/bin/env bash set -eu -o pipefail # Check helm is installed if ! command -v helm &> /dev/null; then echo "Helm is not installed. Please install helm first." exit 1 fi # Check REPO.list is exist in helm-repos directory if [ ! -f helm-repos/REPO.list ]; then echo "REPO.list is not exist in helm-repos directory. Please create REPO.list file first." exit 1 fi # Read REPO.list file in helm-repos directory, and add them to helm repos while IFS= read -r line do # Split line with comma IFS=',' read -r -a array <<< "$line" echo "Add helm repo ${array[0]} with url ${array[1]}, and ${array[2]}" cmd="helm repo add ${array[0]} ${array[1]} --${array[2]}" # execute command eval "$cmd" done < helm-repos/REPO.list echo "Helm repos are added successfully."