Skip to content

Commit

Permalink
Pack to specified location & push to gcs
Browse files Browse the repository at this point in the history
  • Loading branch information
olereidar committed May 15, 2019
1 parent 0da2d99 commit b83791f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
14 changes: 8 additions & 6 deletions src/commands/authenticate-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parameters:
gcp-container-cluster:
description: |
The name of the Google Cloud container cluster to use.
If not provided, the command will look for the environment variable $CLOUDSDK_CONTAINER_CLUSTER
If not provided, the command will look for the environment variable $CLOUDSDK_CONTAINER_CLUSTER.
To obtain the name of your clusters,
use the Google Cloud Platform Console (Command: gcloud container clusters list)
Expand Down Expand Up @@ -50,17 +50,19 @@ steps:
exit 1
fi
echo ${CREDENTIALS} > ${HOME}/account-auth.json
gcloud auth activate-service-account --key-file ${HOME}/account-auth.json
CLUSTER="<< parameters.gcp-container-cluster >>"
if [[ -n "${CLUSTER}" ]]; then
echo "Using cluster provided in parameters."
elif [[ -n "${CLOUDSDK_CONTAINER_CLUSTER}" ]]; then
echo "Using cluster from environment."
CLUSTER="${CLOUDSDK_CONTAINER_CLUSTER}"
else
echo "No cluster were found. Looked in parameters and environment."
exit 1
echo "No cluster were found. Looked in parameters and environment. Skipping authenticating to cluster."
fi
echo ${CREDENTIALS} > ${HOME}/account-auth.json
gcloud auth activate-service-account --key-file ${HOME}/account-auth.json
gcloud --quiet container clusters get-credentials ${CLUSTER}
if [[ -n "${CLUSTER}" ]]; then
gcloud --quiet container clusters get-credentials ${CLUSTER}
fi
24 changes: 17 additions & 7 deletions src/commands/push-helm-chart-to-gcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,21 @@ parameters:
Specify a chart reference (e.g. helm/mychart),
or a path to an unpacked chart directory (e.g. ./helm)
type: string
packed-chart-name:
app-version: # TODO: Not implemented
description: |
Specify the name of the packed chart.
The command will pack the specified chart to a compressed .tgz file.
Set the appVersion on the chart to this version.
type: string
default: ""
version: # TODO: Not implemented
description: |
Set the version on the chart to this semver version
type: string
default: ""
dependency-update: # TODO: Not implemented
description: |
Update dependencies from "requirements.yaml" before packaging
type: boolean
default: false

#| ---- Helm GCS Plugin ---- |#
gcs-plugin-version:
Expand Down Expand Up @@ -74,13 +84,13 @@ steps:
name: Package Helm chart
command: |
CHART_LOCATION="<< parameters.chart >>"
PACKED_CHART_NAME="<< parameters.packed-chart-name >>"
echo "Packing chart from ${CHART_LOCATION} to ${PACKED_CHART_NAME}.tgz"
helm package ${CHART_LOCATION}
mkdir -p build/helm
echo "Packing chart from ${CHART_LOCATION} to build/helm."
helm package ${CHART_LOCATION} --destination build/helm
- run:
name: Push Helm chart to GCS bucket
command: |
BUCKET_NAME="<< parameters.gcs-bucket-name >>"
PACKED_CHART_NAME="<< parameters.packed-chart-name >>"
PACKED_CHART_NAME=$(basename build/helm/*)
echo "Preparing to push ${PACKED_CHART_NAME}.tgz to ${BUCKET_NAME}."
helm gcs push ${PACKED_CHART_NAME}.tgz ${BUCKET_NAME}

0 comments on commit b83791f

Please sign in to comment.