github.com/rancher/elemental/tests@v0.0.0-20240517125144-ae048c615b3f/scripts/deploy-chartmuseum (about) 1 #!/bin/bash 2 3 # This script deploys a local helm repo to host the dev operator chart 4 # because it is not exported anywhere else. 5 6 set -e -x 7 8 # Add missing PATH, removed in recent distributions for security reasons... 9 PATH+=:/usr/local/bin 10 11 # Variables 12 REPO=$1 13 14 # Create a systemctl file for chartmuseum 15 cat > /etc/systemd/system/chartmuseum.service << EOF 16 [Unit] 17 Description=Chartmuseum server 18 19 [Service] 20 Type=simple 21 User=gh-runner 22 Group=users 23 24 Environment=DEBUG=1 25 Environment=STORAGE=local 26 Environment=STORAGE_LOCAL_ROOTDIR=/home/gh-runner/charts 27 28 WorkingDirectory=/tmp 29 ExecStart=/usr/local/bin/chartmuseum --port=8080 30 31 [Install] 32 WantedBy=multi-user.target 33 EOF 34 35 # Download and install chartmuseum 36 curl https://raw.githubusercontent.com/helm/chartmuseum/main/scripts/get-chartmuseum | bash 37 38 # Start chartmuseum 39 systemctl start chartmuseum 40 41 # Download and install helm-push plugin 42 helm plugin install https://github.com/chartmuseum/helm-push.git 43 44 # Create a local helm repo 45 helm repo add chartmuseum http://localhost:8080 46 47 # Download needed helm charts 48 helm pull $REPO/elemental-operator-crds-chart 49 helm pull $REPO/elemental-operator-chart 50 51 # Extract helm charts 52 tar -xvzf elemental-operator-crds-* 53 tar -xvzf elemental-operator-chart-* 54 55 # Push helm charts to local repo 56 helm cm-push elemental-operator chartmuseum 57 helm cm-push elemental-operator-crds chartmuseum