Skip to content

Commit 5cd8494

Browse files
committed
helm-repo-add
1 parent 67f184f commit 5cd8494

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

applications/wg-easy/Taskfile.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,32 @@ tasks:
145145
- cluster-create
146146
- verify-kubeconfig
147147

148+
helm-repo-add:
149+
desc: Add all HTTP/HTTPS Helm repositories found in Chart.yaml files
150+
silent: false
151+
run: once
152+
cmds:
153+
- echo "Adding Helm repositories from Chart.yaml files..."
154+
- |
155+
# Find all Chart.yaml files and extract HTTP/HTTPS repositories
156+
for chart_file in $(find charts/ -maxdepth 2 -name "Chart.yaml"); do
157+
echo "Processing $chart_file"
158+
159+
# Extract repository URLs that start with http:// or https://
160+
yq eval '.dependencies[]?.repository' "$chart_file" 2>/dev/null | grep -E '^https?://' | while read -r repo_url; do
161+
if [ -n "$repo_url" ]; then
162+
# Generate a repository name from the URL
163+
repo_name=$(echo "$repo_url" | sed 's|https\?://||' | sed 's|[./]|-|g' | sed 's|-*$||')
164+
165+
echo "Adding repository: $repo_name -> $repo_url"
166+
helm repo add "$repo_name" "$repo_url" || echo "Repository $repo_name may already exist"
167+
fi
168+
done
169+
done
170+
- echo "Updating Helm repository index..."
171+
- helm repo update
172+
- echo "All Helm repositories added and updated!"
173+
148174
dependencies-update:
149175
desc: Update Helm dependencies for all charts
150176
silent: false
@@ -158,6 +184,8 @@ tasks:
158184
helm dependency update --skip-refresh "$chart_dir"
159185
done
160186
- echo "All dependencies updated!"
187+
deps:
188+
- helm-repo-add
161189

162190
cluster-ports-expose:
163191
desc: Expose configured ports for a cluster and capture exposed URLs

0 commit comments

Comments
 (0)