Skip to content

PROD Cluster helm diff on main #25

PROD Cluster helm diff on main

PROD Cluster helm diff on main #25

name: PROD Cluster helm diff
run-name: PROD Cluster helm diff on ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
debug:
description: "Whether print debug info during the deployment"
required: true
default: "No"
type: choice
options:
- "Yes"
- "No"
env:
CLUSTER_NAME: search-data-gov-au-new
CLUSTER_ZONE: australia-southeast1
GCP_PROJECT: terriajs
RELEASE_NAME: magda
DEPLOY_NAMESPACE: dga-prod
GCP_SRV_ACC_NAME: [email protected]
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}
DEPLOY_CHART: "./chart"
DEPLOY_CONFIG_FILE: "./config.yaml"
jobs:
prod-cluster-helm-diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install gke-gcloud-auth-plugin
run: |
REPO_URL="https://packages.cloud.google.com/apt"
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] $REPO_URL cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update -y
sudo apt-get install -y google-cloud-sdk-gke-gcloud-auth-plugin
- name: Install Helm diff
run: helm plugin install https://github.com/databus23/helm-diff
- name: Login to GAR & Cluster
run: |
echo $GCLOUD_KEY > ./gcloud-key.json
gcloud auth activate-service-account ${GCP_SRV_ACC_NAME} --key-file=./gcloud-key.json
gcloud auth configure-docker australia-southeast1-docker.pkg.dev
gcloud container clusters get-credentials \
${CLUSTER_NAME} \
--zone ${CLUSTER_ZONE} \
--project ${GCP_PROJECT}
- name: Download Helm Chart Dependencies
run: |
helm dep up ./chart
- name: Generating Helm Diff Info
env:
DEPLOYMENT_DEBUG: ${{ inputs.debug }}
run: |
echo "Deployment Debug Switch: $DEPLOYMENT_DEBUG"
if [[ "$DEPLOYMENT_DEBUG" == "Yes" ]]; then
export HELM_DEPLOYMENT_SWITCH_DEBUG="--debug"
else
export HELM_DEPLOYMENT_SWITCH_DEBUG=""
fi
helm diff upgrade ${HELM_DEPLOYMENT_SWITCH_DEBUG} \
--install \
--namespace ${DEPLOY_NAMESPACE} \
${RELEASE_NAME} \
${DEPLOY_CHART} \
-f ${DEPLOY_CONFIG_FILE}