Compare commits

..

1 Commits

Author SHA1 Message Date
Andrei Kvapil
3d0caaab19 [platform] Automatically exclude dependencies on disabled optional components
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-05-07 16:03:19 +02:00
5 changed files with 24 additions and 45 deletions

View File

@@ -1,37 +0,0 @@
#!/bin/sh
set -e
REPO_NAME="$(basename "$PWD")"
OUT="../../_out/repos/$REPO_NAME"
TMP="../../_out/repos/$REPO_NAME/historical"
if [ ! -f "versions_map" ]; then
echo "Script should be called from packages/<repo>!" >&2
exit 1
fi
(set -x; rm -rf "$OUT")
(set -x; mkdir -p "$OUT")
while read chart version commit; do
if [ $commit = "HEAD" ]; then
(set -x; helm package -d "$OUT" "$chart")
continue
fi
mkdir -p "$TMP/$chart-$version"
(set -x; git archive "$commit" "$chart" | tar -xf- --strip-components=1 -C "$TMP/$chart-$version")
if [ -d "$TMP/$chart-$version/charts" ]; then
(set -x; find "$TMP/$chart-$version/charts" -type l -maxdepth 1 -mindepth 1) | awk -F/ '{print $NF}' | while read library_chart; do
(set -x; rm -f "$TMP/$chart-$version/charts/$library_chart")
(set -x; cd ../library && git archive "$commit" "$library_chart" | tar -xf- -C "$TMP/$chart-$version/charts/")
done
fi
rm -rf "$tmp"
done < versions_map
(set -x; helm package -d "$OUT" $(find . "$TMP" -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")' | sort -V))
(set -x; cd "$OUT" && helm repo index . --url "http://cozystack.cozy-system.svc/repos/$REPO_NAME")
(set -x; rm -rf "$TMP")

View File

@@ -1,5 +1,14 @@
OUT=../../_out/repos/apps
TMP=../../_out/repos/apps/historical
repo:
../../hack/build-repo.sh
rm -rf "$(OUT)"
mkdir -p "$(OUT)"
awk '$$3 != "HEAD" {print "mkdir -p $(TMP)/" $$1 "-" $$2}' versions_map | sh -ex
awk '$$3 != "HEAD" {print "git archive " $$3 " " $$1 " | tar -xf- --strip-components=1 -C $(TMP)/" $$1 "-" $$2 }' versions_map | sh -ex
helm package -d "$(OUT)" $$(find . $(TMP) -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")' | sort -V)
cd "$(OUT)" && helm repo index . --url http://cozystack.cozy-system.svc/repos/apps
rm -rf "$(TMP)"
fix-chartnames:
find . -maxdepth 2 -name Chart.yaml | awk -F/ '{print $$2}' | while read i; do sed -i "s/^name: .*/name: $$i/" "$$i/Chart.yaml"; done

View File

@@ -321,12 +321,7 @@ releases:
name: kubeapps-auth-config
valuesKey: values.yaml
{{- end }}
{{- if eq $oidcEnabled "true" }}
dependsOn: [keycloak-configure]
{{- else }}
dependsOn: []
{{- end }}
- name: kamaji
releaseName: kamaji

View File

@@ -7,6 +7,9 @@
{{/* collect dependency namespaces from releases */}}
{{- range $x := $bundle.releases }}
{{- if or (has $x.name $disabledComponents) (and ($x.optional) (not (has $x.name $enabledComponents))) }}
{{- continue }}
{{- end }}
{{- $_ := set $dependencyNamespaces $x.name $x.namespace }}
{{- end }}
@@ -86,7 +89,7 @@ spec:
{{- with $x.dependsOn }}
dependsOn:
{{- range $dep := . }}
{{- if not (has $dep $disabledComponents) }}
{{- if hasKey $dependencyNamespaces $dep }}
- name: {{ $dep }}
namespace: {{ index $dependencyNamespaces $dep }}
{{- end }}

View File

@@ -1,5 +1,14 @@
OUT=../../_out/repos/extra
TMP=../../_out/repos/extra/historical
repo:
../../hack/build-repo.sh
rm -rf "$(OUT)"
mkdir -p "$(OUT)"
awk '$$3 != "HEAD" {print "mkdir -p $(TMP)/" $$1 "-" $$2}' versions_map | sh -ex
awk '$$3 != "HEAD" {print "git archive " $$3 " " $$1 " | tar -xf- --strip-components=1 -C $(TMP)/" $$1 "-" $$2 }' versions_map | sh -ex
helm package -d "$(OUT)" $$(find . $(TMP) -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")' | sort -V)
cd "$(OUT)" && helm repo index . --url http://cozystack.cozy-system.svc/repos/extra
rm -rf "$(TMP)"
fix-chartnames:
find . -maxdepth 2 -name Chart.yaml | awk -F/ '{print $$2}' | while read i; do sed -i "s/^name: .*/name: $$i/" "$$i/Chart.yaml"; done