Skip to content

Instantly share code, notes, and snippets.

@JonJam
Created March 7, 2018 09:40
Show Gist options
  • Save JonJam/d08a1d555d2489556d4d1956e039b2f3 to your computer and use it in GitHub Desktop.
Save JonJam/d08a1d555d2489556d4d1956e039b2f3 to your computer and use it in GitHub Desktop.
k8s helm - deploy script
#!/bin/bash
# Setting -e and -v as pert https://docs.travis-ci.com/user/customizing-the-build/#Implementing-Complex-Build-Steps
# -e: immediately exit if any command has a non-zero exit status
# -v: print all lines in the script before executing them
# -o: prevents errors in a pipeline from being masked
set -euo pipefail
# IFS new value is less likely to cause confusing bugs when looping arrays or arguments (e.g. $@)
IFS=$'\n\t'
# Follow the steps here to create a Service Principal: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal
az login --service-principal -u $SERVICE_PRINCIPAL_ID -p $SERVICE_PRINCIPAL_SECRET --tenant $TENANT 1> /dev/null
echo "Getting credentials for cluster..."
az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP_NAME
echo "Initialising helm..."
helm init --client-only --override storage=secret
echo "Updating chart lists..."
helm repo update
echo "Updating chart dependencies..."
helm dependency update ./themeparks-bot/
echo "Installing release"
helm upgrade --install "one-and-only" --set image.tag=0.0.$TRAVIS_BUILD_NUMBER,secret.luisAppUrl=$LUIS_APP_URL,secret.storageAccountName=$STORAGE_ACCOUNT_NAME,secret.storageAccountKey=$STORAGE_ACCOUNT_KEY,secret.microsoftAppId=$MICROSOFT_APP_ID,secret.microsoftAppPassword=$MICROSOFT_APP_PASSWORD ./themeparks-bot/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment