Skip to content

Deploy to AKS cluster #955

Deploy to AKS cluster

Deploy to AKS cluster #955

Workflow file for this run

concurrency: build_and_deploy_${{ github.ref_name }}
name: Deploy to AKS cluster
on:
workflow_dispatch:
inputs:
environment:
description: Environment to deploy to
required: true
type: choice
default: review
options:
- qa
- review
- staging
- sandbox
- dv_review
- pt_review
sha:
description: Commit sha to be deployed
required: true
pr-number:
description: PR number for review apps (Optional)
required: false
dev-cluster:
description: Development cluster name (Optional)
required: false
jobs:
deploy:
name: ${{ inputs.environment }} deployment
environment:
name: ${{ inputs.environment }}
concurrency: deploy_all
runs-on: ubuntu-latest
permissions:
pull-requests: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
- name: Fetch secrets from key vault
if: ${{ inputs.environment != 'review' && inputs.environment != 'dv_review' }}
uses: azure/CLI@v2
id: keyvault-yaml-secret
with:
inlineScript: |
SLACK_WEBHOOK=$(az keyvault secret show --name "SLACK-WEBHOOK" --vault-name "${{ secrets.INF_KEY_VAULT }}" --query "value" -o tsv)
echo "::add-mask::$SLACK_WEBHOOK"
echo "SLACK_WEBHOOK=$SLACK_WEBHOOK" >> $GITHUB_OUTPUT
- uses: ./.github/actions/deploy-environment
id: deploy
with:
environment: ${{ inputs.environment }}
docker-image: ${{ inputs.sha }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
pull-request-number: ${{ inputs.pr-number }}
dev-cluster: ${{ inputs.dev-cluster }}
- name: Post comment to Pull Request ${{ inputs.pr-number }}
if: ${{ inputs.environment != 'review' && inputs.environment != 'dv_review' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: aks
message: |
### Deployments
| App | URL |
| ----------------- | ---------------------------------------------------------------------------------------- |
| Track & Pay | <https://track-and-pay-${{ inputs.pr-number }}.test.teacherservices.cloud> |
| School Placements | <https://manage-school-placements-${{ inputs.pr-number }}.test.teacherservices.cloud> |
- name: Slack Notification
if: ${{ failure() && inputs.environment != 'review' }}
uses: rtCamp/action-slack-notify@master
env:
SLACK_COLOR: failure
SLACK_TITLE: Failure deploying release to${{ inputs.environment }}
SLACK_MESSAGE: Failure deploying release to ${{ inputs.environment }} - Docker tag ${{ inputs.sha }}
SLACK_WEBHOOK: ${{ steps.keyvault-yaml-secret.outputs.SLACK_WEBHOOK }}