|
| 1 | +#!/bin/bash -xe |
| 2 | +# Copyright 2017 The Kubernetes Authors. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +HELM_URL=https://storage.googleapis.com/kubernetes-helm |
| 17 | +HELM_TARBALL=helm-v2.6.2-linux-amd64.tar.gz |
| 18 | +SVC_CATALOG_BUCKET=svc-catalog-charts |
| 19 | +SVC_CATALOG_REPO_URL=https://$SVC_CATALOG_BUCKET.storage.googleapis.com/ |
| 20 | + |
| 21 | +# Setup Helm |
| 22 | +wget -q ${HELM_URL}/${HELM_TARBALL} |
| 23 | +tar xzfv ${HELM_TARBALL} |
| 24 | +PATH=`pwd`/linux-amd64/:$PATH |
| 25 | +helm init --client-only |
| 26 | + |
| 27 | +# Authenticate before uploading to Google Cloud Storage |
| 28 | +cat > sa.json <<EOF |
| 29 | +$SERVICE_ACCOUNT_JSON |
| 30 | +EOF |
| 31 | +gcloud auth activate-service-account --key-file sa.json |
| 32 | + |
| 33 | +# Create the repository |
| 34 | +SVC_CATALOG_REPO_DIR=svc-catalog-repo |
| 35 | +mkdir -p ${SVC_CATALOG_REPO_DIR} |
| 36 | +cd ${SVC_CATALOG_REPO_DIR} |
| 37 | + gsutil cp gs://$SVC_CATALOG_BUCKET/index.yaml . |
| 38 | + for dir in `ls ../charts`;do |
| 39 | + helm dep build ../charts/$dir |
| 40 | + helm package ../charts/$dir |
| 41 | + done |
| 42 | + helm repo index --url ${SVC_CATALOG_REPO_URL} --merge ./index.yaml . |
| 43 | + gsutil -m rsync ./ gs://$SVC_CATALOG_BUCKET/ |
| 44 | +cd .. |
| 45 | +ls -l ${SVC_CATALOG_REPO_DIR} |
0 commit comments