From fbb73e6202bb50d3bec2a60fa4ec7cc9fc009186 Mon Sep 17 00:00:00 2001 From: mmontes11 Date: Wed, 25 Sep 2024 14:42:19 +0200 Subject: [PATCH] Updated sync-chart.sh to sync CRDs from mariadb-operator CRDs chart --- hack/sync-chart.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/hack/sync-chart.sh b/hack/sync-chart.sh index 722af42..116cd99 100755 --- a/hack/sync-chart.sh +++ b/hack/sync-chart.sh @@ -2,9 +2,19 @@ set -euo pipefail +install_yq() { + if ! command -v yq &> /dev/null; then + echo "yq command not found, installing yq..." + sudo curl -sSLo /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_linux_amd64 + sudo chmod +x /usr/local/bin/yq + fi +} +install_yq + HELM_CHART_VERSION=$1 HELM_CHART_DIR="helm-charts/mariadb-operator" -RELEASE_URL="https://github.com/mariadb-operator/mariadb-operator/releases/download/helm-chart-$HELM_CHART_VERSION/mariadb-operator-$HELM_CHART_VERSION.tgz" +HELM_CHART_FILE="$HELM_CHART_DIR/Chart.yaml" +RELEASE_URL="https://github.com/mariadb-operator/mariadb-operator/releases/download/mariadb-operator-$HELM_CHART_VERSION/mariadb-operator-$HELM_CHART_VERSION.tgz" echo "☸️ Syncing helm chart version $HELM_CHART_VERSION"; if [ -d "$HELM_CHART_DIR" ]; then @@ -12,5 +22,10 @@ if [ -d "$HELM_CHART_DIR" ]; then fi curl -sL $RELEASE_URL | tar xz -C helm-charts/ +HELM_CRDS_VERSION=$(yq e '.dependencies[] | select(.name == "mariadb-operator-crds").version' $HELM_CHART_FILE) + +echo "☸️ Unpacking CRDs version $HELM_CRDS_VERSION"; +tar xz -f "helm-charts/mariadb-operator/charts/mariadb-operator-crds-$HELM_CRDS_VERSION.tgz" -C "helm-charts/" + echo "☸️ Syncing CRDs"; -cp helm-charts/mariadb-operator/crds/crds.yaml config/manifests/crds/crds.yaml \ No newline at end of file +cp helm-charts/mariadb-operator-crds/templates/crds.yaml config/manifests/crds/crds.yaml \ No newline at end of file