Skip to content

CD Release - AKS

CD Release - AKS #47

Workflow file for this run

#
# Deploy to Azure Kubernetes Service
# Using Helm for parameterized deployment
#
name: CD Release - AKS
on:
workflow_dispatch:
inputs:
IMAGE_TAG:
description: 'Image tag to be deployed'
required: true
default: 'latest'
# Note. Required secrets: CLUSTER_KUBECONFIG
env:
CLUSTER_NAME: sandbox
HELM_RELEASE: nodejs
HELM_NAMESPACE: demoapps
INGRESS_DNS_HOST: nodejs-demoapp.kube.benco.io
jobs:
#
# Deploy to Kubernetes (AKS)
#
deploy-aks:
name: Deploy to AKS with Helm
runs-on: ubuntu-latest
environment:
name: AKS - nodejs-demoapp
url: https://${{ env.INGRESS_DNS_HOST }}/
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Set kubeconfig'
uses: azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig: ${{ secrets.CLUSTER_KUBECONFIG }}
context: ${{ env.CLUSTER_NAME }}
- name: 'Helm release'
run: |
helm repo add benc-uk https://benc-uk.github.io/helm-charts
helm upgrade ${{ env.HELM_RELEASE }} benc-uk/webapp \
--install \
--namespace ${{ env.HELM_NAMESPACE }} \
--values deploy/kubernetes/aks-mine.yaml \
--set image.tag=${{ github.event.inputs.IMAGE_TAG }},ingress.host=${{ env.INGRESS_DNS_HOST }},env.AAD_REDIRECT_URL_BASE=https://${{ env.INGRESS_DNS_HOST }}
#
# Post deployment testing stage
#
validate-deployment:
name: 'Run Deployment Tests'
needs: deploy-aks
runs-on: ubuntu-latest
environment:
name: AKS - nodejs-demoapp
url: https://${{ env.INGRESS_DNS_HOST }}/
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Validate site is running'
run: .github/scripts/url-check.sh -u https://${{ env.INGRESS_DNS_HOST }} -s "Node.js Demo App" -t 200
- name: 'Integration tests'
run: |
make test TEST_BASE_URL=https://${{ env.INGRESS_DNS_HOST }} "TEST_FILES={base-tests,weather-tests}.http"