Skip to content

Commit

Permalink
Use SLACK-WEBHOOK secret
Browse files Browse the repository at this point in the history
We want to grab the secret from the key vault rather than from the
GitHub environment so we can keep them all in one place.
  • Loading branch information
thomasleese committed Jul 20, 2023
1 parent eb57aed commit ca81ad4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,26 @@ jobs:
path: backup-sanitised.sql.gz
retention-days: 3

- id: key-vault-name
if: failure()
shell: bash
run: echo "value=$(make -s production_aks print-infrastructure-key-vault-name)" >> $GITHUB_OUTPUT

- uses: Azure/get-keyvault-secrets@v1
if: failure()
id: key-vault-secrets
with:
keyvault: ${{ steps.key-vault-name.outputs.value }}
secrets: "SLACK-WEBHOOK"

- name: Notify Slack channel on job failure
if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_USERNAME: CI Deployment
SLACK_TITLE: Database backup failure
SLACK_MESSAGE: Production database backup job failed
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_WEBHOOK: ${{ steps.key-vault-secrets.outputs.SLACK-WEBHOOK }}
SLACK_COLOR: failure
SLACK_FOOTER: Sent from backup-production job in database-backups workflow

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ jobs:
SLACK_TITLE: Deployment of apply-for-qualified-teacher-status to ${{ needs.deploy_nonprod_aks.outputs.environment_name }} failed
SLACK_MESSAGE: |
Deployment to ${{ needs.deploy_nonprod_aks.outputs.environment_name }} environment failed
SLACK_WEBHOOK: ${{ steps.keyvault-yaml-secret.outputs.SLACK_WEBHOOK }}
SLACK_WEBHOOK: ${{ steps.key-vault-secrets.outputs.SLACK-WEBHOOK }}
SLACK_COLOR: failure
SLACK_FOOTER: Sent from notify_slack_of_failures job in deploy workflow

0 comments on commit ca81ad4

Please sign in to comment.