Skip to content

Commit fbb73e6

Browse files
committed
Updated sync-chart.sh to sync CRDs from mariadb-operator CRDs chart
1 parent 1dc382b commit fbb73e6

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

hack/sync-chart.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,30 @@
22

33
set -euo pipefail
44

5+
install_yq() {
6+
if ! command -v yq &> /dev/null; then
7+
echo "yq command not found, installing yq..."
8+
sudo curl -sSLo /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_linux_amd64
9+
sudo chmod +x /usr/local/bin/yq
10+
fi
11+
}
12+
install_yq
13+
514
HELM_CHART_VERSION=$1
615
HELM_CHART_DIR="helm-charts/mariadb-operator"
7-
RELEASE_URL="https://github.com/mariadb-operator/mariadb-operator/releases/download/helm-chart-$HELM_CHART_VERSION/mariadb-operator-$HELM_CHART_VERSION.tgz"
16+
HELM_CHART_FILE="$HELM_CHART_DIR/Chart.yaml"
17+
RELEASE_URL="https://github.com/mariadb-operator/mariadb-operator/releases/download/mariadb-operator-$HELM_CHART_VERSION/mariadb-operator-$HELM_CHART_VERSION.tgz"
818

919
echo "☸️ Syncing helm chart version $HELM_CHART_VERSION";
1020
if [ -d "$HELM_CHART_DIR" ]; then
1121
rm -rf $HELM_CHART_DIR
1222
fi
1323
curl -sL $RELEASE_URL | tar xz -C helm-charts/
1424

25+
HELM_CRDS_VERSION=$(yq e '.dependencies[] | select(.name == "mariadb-operator-crds").version' $HELM_CHART_FILE)
26+
27+
echo "☸️ Unpacking CRDs version $HELM_CRDS_VERSION";
28+
tar xz -f "helm-charts/mariadb-operator/charts/mariadb-operator-crds-$HELM_CRDS_VERSION.tgz" -C "helm-charts/"
29+
1530
echo "☸️ Syncing CRDs";
16-
cp helm-charts/mariadb-operator/crds/crds.yaml config/manifests/crds/crds.yaml
31+
cp helm-charts/mariadb-operator-crds/templates/crds.yaml config/manifests/crds/crds.yaml

0 commit comments

Comments
 (0)