Skip to content

Commit 5fade78

Browse files
authored
Merge pull request #3114 from grafana/update-helm-repo-fix-deps
Don't hardcode helm charts dependencies in shared release workflow
2 parents e7a151e + 3b56b02 commit 5fade78

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

.github/workflows/update-helm-repo.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,6 @@ jobs:
145145
with:
146146
version: v3.5.2
147147

148-
- name: Add dependency chart repos
149-
# Todo replace this by https://github.com/grafana/helm-charts/issues/1534
150-
run: |
151-
helm repo add elastic https://helm.elastic.co
152-
helm repo add grafana https://grafana.github.io/helm-charts
153-
helm repo add prometheus https://prometheus-community.github.io/helm-charts
154-
helm repo add bitnami https://charts.bitnami.com/bitnami
155-
helm repo add bitnami-pre-2022 https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
156-
helm repo add hashicorp https://helm.releases.hashicorp.com
157-
helm repo add minio-new https://charts.min.io
158-
helm repo add jetstack https://charts.jetstack.io
159-
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
160-
161148
- name: Parse Chart.yaml
162149
id: parse-chart
163150
run: |
@@ -175,6 +162,21 @@ jobs:
175162
fi
176163
echo "packagename=${name}-${version}" >> $GITHUB_OUTPUT
177164
165+
- name: Add dependency chart repos
166+
run: |
167+
cd source
168+
# Skip the header line and make sure that tabs are expanded into spaces
169+
deps=$(helm dependency list "${{ steps.parse-chart.outputs.chartpath }}" | tail +2 | expand)
170+
while read -r row; do
171+
IFS=' ' read -ra parts <<< "$row"
172+
name="${parts[0]}"
173+
repo="${parts[2]}"
174+
case "$repo" in
175+
"https://"*) helm repo add "$name" "$repo" ;;
176+
*) echo >&2 "Skipping dependency $name: unsupported schema for \"$repo\"" ;;
177+
esac
178+
done <<< "$deps"
179+
178180
- name: Install CR tool
179181
run: |
180182
mkdir "${CR_TOOL_PATH}"

0 commit comments

Comments
 (0)