Skip to content

Commit

Permalink
First pass at init and push
Browse files Browse the repository at this point in the history
  • Loading branch information
Vic Iglesias committed Oct 25, 2017
1 parent 6bd4d36 commit 562ae19
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 9 deletions.
35 changes: 35 additions & 0 deletions bin/gcs-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash -e
COMMAND=$1

case $COMMAND in
init)
BUCKET=$2
if [[ -z "$2" ]];then
echo "Please provide a bucket URL in the format gs://BUCKET"
exit 1
else
gsutil cp -n $HELM_PLUGIN_DIR/etc/index.yaml $BUCKET
echo "Repository initialized..."
exit 0
fi
;;
push)
CHART_PATH=$2
BUCKET=$3
TMP_DIR=$(mktemp -d)
TMP_REPO=$TMP_DIR/repo
OLD_INDEX=$TMP_DIR/old-index.yaml

gsutil cat $BUCKET/index.yaml > $OLD_INDEX
mkdir $TMP_REPO
cp $CHART_PATH $TMP_REPO
helm repo index --merge $OLD_INDEX --url $BUCKET $TMP_REPO
gsutil cp $TMP_REPO/index.yaml $BUCKET
gsutil cp $TMP_REPO/$(basename $CHART_PATH) $BUCKET
echo "Repository initialized..."
;;
*)
# TODO turn this into usage()
echo "Please provide a command."
;;
esac
4 changes: 4 additions & 0 deletions bin/gcs-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
REPO=$4
gsutil cat $REPO
exit 0
5 changes: 0 additions & 5 deletions bin/gcs.sh

This file was deleted.

1 change: 1 addition & 0 deletions etc/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apiVersion: v1
8 changes: 4 additions & 4 deletions plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: "gcs"
version: "0.1.0"
usage: "The plugin allows to use gcs protocol to upload, fetch charts and to work with repositories."
usage: "This plugin allows to use gcs protocol to upload, fetch charts and to work with repositories."
description: |-
Provides Google Cloud Storage protocol support.
https://github.com/viglesiasce/helm-gcs
command: "$HELM_PLUGIN_DIR/bin/gcs.sh"
command: "$HELM_PLUGIN_DIR/bin/gcs-helper.sh"
downloaders:
- command: "bin/gcs.sh"
- command: "bin/gcs-repo.sh"
protocols:
- "gcs"
- "gs"

0 comments on commit 562ae19

Please sign in to comment.