Skip to content

Commit

Permalink
Merge pull request #1 from snebel29/feat/add-usage
Browse files Browse the repository at this point in the history
Feat/add usage
  • Loading branch information
Vic Iglesias authored Jan 30, 2018
2 parents c3d2432 + 16ff999 commit b44225f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Helm plugin for using Google Cloud Storage as a private chart repository.
1. Install the Helm plugin

```shell
$ helm plugin install https://github.com/viglesiasce/helm-gcs.git --version v0.1.0
$ helm plugin install https://github.com/viglesiasce/helm-gcs.git --version v0.2.0
```

## Usage
Expand Down
39 changes: 35 additions & 4 deletions bin/gcs-helper.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
#!/bin/bash -e

function usage() {
if [[ ! -z "$1" ]]; then
printf "$1\n\n"
fi
cat <<' EOF'
Helm plugin for using Google Cloud Storage as a private chart repository
To begin working with helm-gcs plugin, authenticate gcloud
$ gcloud auth login
Usage:
helm gcs init [BUCKET_URL]
helm gcs push [CHART_FILE] [BUCKET_URL]
Available Commands:
init Initialize an existing Cloud Storage Bucket to a Helm repo
push Upload the chart to your bucket
Example:
$ helm gcs init gs://my-unique-helm-repo-bucket-name
$ helm gcs push my-chart-0.1.0.tgz gs://my-unique-helm-repo-bucket-name
EOF
}
COMMAND=$1
case $COMMAND in
init)
BUCKET=$2
if [[ -z "$2" ]];then
echo "Please provide a bucket URL in the format gs://BUCKET"
if [[ -z "$2" ]]; then
usage "Error: Please provide a bucket URL in the format gs://BUCKET"
exit 1
else
gsutil cp -n $HELM_PLUGIN_DIR/etc/index.yaml $BUCKET
Expand All @@ -14,6 +42,10 @@ init)
fi
;;
push)
if [[ -z "$2" ]] || [[ -z "$3" ]]; then
usage "Error: Please provide chart file and/or bucket URL in the format gs://BUCKET"
exit 1
fi
CHART_PATH=$2
BUCKET=$3
TMP_DIR=$(mktemp -d)
Expand All @@ -29,7 +61,6 @@ push)
echo "Repository initialized..."
;;
*)
# TODO turn this into usage()
echo "Please provide a command."
usage
;;
esac
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "gcs"
version: "0.1.0"
version: "0.2.0"
usage: "This plugin allows to use gcs protocol to upload, fetch charts and to work with repositories."
description: |-
Provides Google Cloud Storage protocol support.
Expand Down

0 comments on commit b44225f

Please sign in to comment.