forked from hmcts/azure-public-dns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
136 lines (129 loc) · 4 KB
/
azure-pipelines.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
# Docs:
# https://aka.ms/yaml
trigger:
batch: true
branches:
include:
- master
resources:
repositories:
- repository: cnp-azuredevops-libraries
type: github
ref: master
name: hmcts/cnp-azuredevops-libraries
endpoint: 'hmcts (1)'
variables:
- name: timeoutInMinutes
value: 60
- name: agentPool
value: 'ubuntu-latest'
- name: build
value: $(Build.BuildNumber)
- name: product
value: CFT
- name: project
value: AzureDNS
- name: terraformInitSubscription
value: 04d27a32-7a07-48b3-95b8-3c8691e1a263
- template: vars/input-variables.yaml@cnp-azuredevops-libraries
parameters:
- name: overrideAction
type: string
default: plan
values:
- plan
- apply
- destroy
- name: environment_components
type: object
default:
- deployment: 'Sandbox'
environment: 'sandbox'
component: 'sandbox'
resource_group_name: 'azure-control-mgmt-rg'
serviceConnection: 'Reform-CFT-Mgmt'
dependsOn:
- Precheck
- deployment: 'Demo'
environment: 'demo'
component: 'demo'
resource_group_name: 'azure-control-mgmt-rg'
serviceConnection: 'Reform-CFT-Mgmt'
dependsOn:
- Precheck
- deployment: 'Dev'
environment: 'dev'
component: 'dev'
resource_group_name: 'azure-control-mgmt-rg'
serviceConnection: 'Reform-CFT-Mgmt'
dependsOn:
- Precheck
- deployment: 'Ithc'
environment: 'ithc'
component: 'ithc'
resource_group_name: 'azure-control-mgmt-rg'
serviceConnection: 'Reform-CFT-Mgmt'
dependsOn:
- Precheck
- deployment: 'Test'
environment: 'test'
component: 'test'
resource_group_name: 'azure-control-mgmt-rg'
serviceConnection: 'Reform-CFT-Mgmt'
dependsOn:
- Precheck
- deployment: 'Staging'
environment: 'staging'
component: 'staging'
resource_group_name: 'azure-control-mgmt-rg'
serviceConnection: 'Reform-CFT-Mgmt'
dependsOn:
- Precheck
- deployment: 'nle'
environment: 'nle'
component: 'nle'
resource_group_name: 'azure-control-mgmt-rg'
serviceConnection: 'Reform-CFT-Mgmt'
dependsOn:
- Precheck
- deployment: 'Prod'
environment: 'prod'
component: 'prod'
resource_group_name: 'azure-control-mgmt-rg'
serviceConnection: 'Reform-CFT-Mgmt'
dependsOn:
- Precheck
stages:
- stage: Precheck
jobs:
- job:
pool:
vmImage: ${{ variables.agentPool }}
timeoutInMinutes: ${{ variables.timeoutInMinutes }}
steps:
- template: steps/terraform-precheck.yaml@cnp-azuredevops-libraries
parameters:
keyvaultName: 'infra-vault-nonprod'
keyvaultSecret: 'azure-devops-token'
serviceConnection: 'azurerm-sandbox'
- ${{ each deployment in parameters.environment_components }}:
- stage: ${{ deployment.deployment }}
dependsOn: ${{ deployment.dependsOn }}
jobs:
- job: TerraformPlanApply
pool:
vmImage: ${{ variables.agentPool }}
timeoutInMinutes: ${{ variables.timeoutInMinutes }}
steps:
- template: steps/terraform.yaml@cnp-azuredevops-libraries
parameters:
overrideAction: ${{ parameters.overrideAction }}
environment: ${{ deployment.environment }}
component: ${{ deployment.component }}
serviceConnection: ${{ deployment.serviceConnection }}
terraformInitSubscription: ${{ variables.terraformInitSubscription }}
product: ${{ variables.product }}
initCommandOptions: >
-backend-config resource_group_name=${{ deployment.resource_group_name }}
planCommandOptions: >
-lock=false