-
Notifications
You must be signed in to change notification settings - Fork 1
154 lines (137 loc) · 5.09 KB
/
deploy-cluster.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Deploy Cluster
on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- labeled
- synchronize
- reopened
- opened
- converted_to_draft
workflow_dispatch:
jobs:
validate-terraform:
name: Validate Terraform
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate cluster/terraform_aks_cluster
uses: ./.github/actions/validate-terraform
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
terraform_root_folder: cluster/terraform_aks_cluster
- name: Validate cluster/terraform_kubernetes
uses: ./.github/actions/validate-terraform
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
terraform_root_folder: cluster/terraform_kubernetes
terraform_modules_tag: main
terraform_modules_dir: aks
- name: Validate custom_domains/terraform/infrastructure
uses: ./.github/actions/validate-terraform
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
terraform_root_folder: custom_domains/terraform/infrastructure
terraform_modules_tag: testing
terraform_modules_dir: domains
- name: Validate templates/new_service/terraform/application
uses: ./.github/actions/validate-terraform
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
terraform_root_folder: templates/new_service/terraform/application
terraform_modules_tag: main
terraform_modules_dir: aks
- name: Validate templates/new_service/terraform/domains/infrastructure
uses: ./.github/actions/validate-terraform
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
terraform_root_folder: templates/new_service/terraform/domains/infrastructure
terraform_modules_tag: testing
terraform_modules_dir: domains
- name: Validate templates/new_service/terraform/domains/environment_domains
uses: ./.github/actions/validate-terraform
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
terraform_root_folder: templates/new_service/terraform/domains/environment_domains
terraform_modules_tag: testing
terraform_modules_dir: domains
- name: Send Slack notification on failure
if: ${{ failure() && github.ref == 'refs/heads/main' }}
uses: rtCamp/action-slack-notify@master
env:
SLACK_COLOR: '#ef5343'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: A Cluster update failure has occurred
SLACK_MESSAGE: |
The terraform validation during cluster update has failed
Workflow Failed: <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View details>
deploy:
name: Deploy Cluster
if: github.ref == 'refs/heads/main'
concurrency: deploy_${{ matrix.environment }}
environment:
name: ${{ matrix.environment }}
needs: [validate-terraform]
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
environment: [platform-test, test, production]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/deploy-environment
with:
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
environment_name: ${{ matrix.environment }}
- name: Send Slack notification on failure
if: failure()
uses: rtCamp/action-slack-notify@master
env:
SLACK_COLOR: '#ef5343'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: A Cluster update failure has occurred
SLACK_MESSAGE: |
The cluster deployment to ${{ matrix.environment }} has failed
Workflow Failed: <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View details>
update-domains:
name: Update DNS domains
if: github.ref == 'refs/heads/main'
concurrency: update_domains_${{ matrix.environment }}
environment:
name: ${{ matrix.environment }}
needs: [deploy]
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
environment: [dev-domain, prod-domain]
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.6.4
terraform_wrapper: false
- name: Set ARM environment variables
uses: DFE-Digital/github-actions/set-arm-environment-variables@master
with:
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
- name: Update DNS in ${{ matrix.environment }}
run: |
make ci ${{ matrix.environment }} domains-infra-apply
shell: bash
env:
TF_VAR_azure_sp_credentials_json: ${{ secrets.AZURE_CREDENTIALS }}
- name: Send Slack notification on failure
if: failure()
uses: rtCamp/action-slack-notify@master
env:
SLACK_COLOR: '#ef5343'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: A Cluster update failure has occurred
SLACK_MESSAGE: |
The domain update to ${{ matrix.environment }} has failed
Workflow Failed: <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View details>