Created
June 8, 2023 16:52
-
-
Save monotek/0cb1ac777a13ed3c38be450349c34839 to your computer and use it in GitHub Desktop.
convert helm repo to oci repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# convert helm repo to oci registry | |
# | |
set -e | |
HELM_REPO="prometheus-community" | |
HELM_REPO_URL="https://prometheus-community.github.io/helm-charts" | |
HELM_REPO_OCI_URL="oci://ghcr.io/prometheus-community/charts" | |
CHART_DIR="charts" | |
mkdir -p $CHART_DIR | |
helm repo add $HELM_REPO $HELM_REPO_URL | |
# pull | |
for CHART in $(helm search repo $HELM_REPO --max-col-width 1000 | awk '{print $1}' | grep -v 'NAME'); do | |
for VERSION in $(helm search repo $CHART -l | awk '{print $2}' | grep -v 'CHART' ); do | |
echo "$CHART $VERSION" | |
helm pull $CHART --version $VERSION -d $CHART_DIR | |
done | |
done | |
# push | |
for CHART in $(ls $CHART_DIR | sort -V); do | |
echo "$CHART" | |
helm push "$CHART_DIR/$CHART" "$HELM_REPO_OCI_URL" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment