forked from hmcts/azure-platform-terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure_pipeline-global.yaml
173 lines (160 loc) · 5.61 KB
/
azure_pipeline-global.yaml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Docs:
# https://aka.ms/yaml
trigger:
batch: true
branches:
include:
- master
paths:
include:
- azure_pipeline-global.yaml
- /modules/azure-landing-zone/*
- /components/global/*
- /environments/demo/demo.tfvars
- /environments/dev/dev.tfvars
- /environments/ithc/ithc.tfvars
- /environments/prod/prod.tfvars
- /environments/ptl/ptl.tfvars
- /environments/sbox/sbox.tfvars
- /environments/stg/stg.tfvars
- /environments/test/test.tfvars
resources:
repositories:
- repository: cnp-azuredevops-libraries
type: github
ref: refs/heads/master
name: hmcts/cnp-azuredevops-libraries
endpoint: 'hmcts'
variables:
- name: timeoutInMinutes
value: 300
- name: agentPool
value: 'hmcts-cftptl-agent-pool'
- name: vmImage
value: 'ubuntu-latest'
- name: build
value: $(Build.BuildNumber)
- name: product
value: cft-platform
- 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: 'sbox_global'
environment: 'sbox'
component: 'global'
service_connection: 'dcd-cftapps-sbox'
storage_account_rg: 'core-infra-sbox-rg'
storage_account_name: 'cftappssbox'
pipeline_tests: true
dependsOn: 'Precheck'
- deployment: 'demo_global'
environment: 'demo'
component: 'global'
service_connection: 'dcd-cftapps-demo'
storage_account_rg: 'core-infra-demo-rg'
storage_account_name: 'cftappsdemo'
dependsOn: 'sbox_global'
- deployment: 'dev_global'
environment: 'dev'
component: 'global'
service_connection: 'dcd-cftapps-dev'
storage_account_rg: 'core-infra-dev-rg'
storage_account_name: 'cftappsdev'
dependsOn: 'sbox_global'
- deployment: 'ithc_global'
environment: 'ithc'
component: 'global'
service_connection: 'dcd-cftapps-ithc'
storage_account_rg: 'core-infra-ithc-rg'
storage_account_name: 'cftappsithc'
pipeline_tests: true
dependsOn: 'sbox_global'
- deployment: 'perftest_global'
environment: 'test'
component: 'global'
service_connection: 'dcd-cftapps-test'
storage_account_rg: 'core-infra-test-rg'
storage_account_name: 'cftappstest'
pipeline_tests: true
dependsOn: 'sbox_global'
- deployment: 'aat_global'
environment: 'stg'
component: 'global'
service_connection: 'dcd-cftapps-stg'
storage_account_rg: 'core-infra-stg-rg'
storage_account_name: 'cftappsstg'
pipeline_tests: true
dependsOn: 'sbox_global'
- deployment: 'prod_global'
environment: 'prod'
component: 'global'
service_connection: 'dcd-cftapps-prod'
storage_account_rg: 'core-infra-prod-rg'
storage_account_name: 'cftappsprod'
pipeline_tests: true
dependsOn: 'sbox_global'
stages:
- stage: Precheck
jobs:
- job:
pool: ${{ 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: ${{ variables.agentPool }}
timeoutInMinutes: ${{ variables.timeoutInMinutes }}
steps:
- task: Bash@3
displayName: run bash commands on internal infrastructure for build test
inputs:
targetType: 'inline'
script: |
curl -v icanhazip.com
ls -laht
pwd
mkdir scripts/
echo "pwd" > scripts/test.sh
chmod +x scripts/test.sh
- template: steps/terraform.yaml@cnp-azuredevops-libraries
parameters:
overrideAction: ${{ parameters.overrideAction }}
environment: ${{ deployment.environment }}
component: ${{ deployment.component }}
serviceConnection: ${{ deployment.service_connection }}
terraformInitSubscription: ${{ variables.terraformInitSubscription }}
product: ${{ variables.product }}
- ${{ if eq(deployment.pipeline_tests, true) }}:
- job: PipelineTests
pool:
vmImage: ${{ variables.vmImage }}
timeoutInMinutes: ${{ variables.timeoutInMinutes }}
dependsOn: TerraformPlanApply
steps:
- template: steps/pipeline-tests-jest.yaml@cnp-azuredevops-libraries
parameters:
workingDirectory: $(Pipeline.Workspace)/s/azure-platform-terraform/scripts
junit_output_dir: $(Pipeline.Workspace)/s/azure-platform-terraform/environments/${{ deployment.environment }}/junit
environment: ${{ deployment.environment }}
product: ${{ variables.product }}
test_title: '${{ deployment.environment }}_${{ deployment.component }}'
test_pattern: pipeline.test.ts