Skip to content

Commit

Permalink
Updated sync-chart.sh to sync CRDs from mariadb-operator CRDs chart
Browse files Browse the repository at this point in the history
  • Loading branch information
mmontes11 committed Sep 25, 2024
1 parent 1dc382b commit fbb73e6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions hack/sync-chart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@

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
rm -rf $HELM_CHART_DIR
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
cp helm-charts/mariadb-operator-crds/templates/crds.yaml config/manifests/crds/crds.yaml

0 comments on commit fbb73e6

Please sign in to comment.