forked from ansible-collections/azure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pr-pipelines.yml
269 lines (260 loc) · 9.58 KB
/
pr-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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
parameters:
- name: PYTHON_VER
displayName: 'Python Version'
type: string
default: "3.9"
values:
- "2.7"
- "3.6"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- name: ANSIBLE_VER
displayName: 'Ansible Version'
type: string
default: "2.15"
values:
- "2.9"
- "2.10"
- "2.11"
- "2.12"
- "2.13" # Eol Nov.6 2023 https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html
- "2.14"
- "2.15"
- "2.16"
- "devel"
- name: MODULE_NAME
displayName: 'Test Module'
type: string
default: 'all'
values:
- 'all'
- 'sanity'
- 'azure_rm_adapplication'
- "azure_rm_acs"
- "azure_rm_adgroup"
- "azure_rm_aduser"
- "azure_rm_aks"
- "azure_rm_aksagentpool"
- "azure_rm_apimanagement"
- "azure_rm_appgateway"
- "azure_rm_appserviceplan"
- "azure_rm_automationaccount"
- "azure_rm_automationrunbook"
- "azure_rm_autoscale"
- "azure_rm_availabilityset"
- "azure_rm_azurefirewall"
- "azure_rm_apimanagementservice"
- "azure_rm_batchaccount"
- "azure_rm_backuppolicy"
- "azure_rm_cdnprofile"
- "azure_rm_containerinstance"
- "azure_rm_containerregistry"
- "azure_rm_containerregistrytag"
- "azure_rm_cosmosdbaccount"
- "azure_rm_datalakestore"
- "azure_rm_ddosprotectionplan"
- "azure_rm_deployment"
- "azure_rm_diskencryptionset"
- "azure_rm_dnsrecordset"
- "azure_rm_dnszone"
- "azure_rm_eventhub"
- "azure_rm_expressroute"
- "azure_rm_firewallpolicy"
- "azure_rm_functionapp"
- "azure_rm_gallery"
- "azure_rm_hdinsightcluster"
- "azure_rm_hostgroup"
- "azure_rm_image"
- "azure_rm_iothub"
- "azure_rm_ipgroup"
- "azure_rm_keyvault"
- "azure_rm_keyvaultkey"
- "azure_rm_keyvaultsecret"
- "azure_rm_loadbalancer"
- "azure_rm_loganalyticsworkspace"
- "azure_rm_manageddisk"
- "azure_rm_managementgroup"
- "azure_rm_mariadbserver"
- "azure_rm_monitordiagnosticsetting"
- "azure_rm_monitorlogprofile"
- "azure_rm_multiplemanageddisks"
- "azure_rm_mysqlserver"
- "azure_rm_natgateway"
- "azure_rm_networkinterface"
- "azure_rm_notificationhub"
- "azure_rm_openshiftmanagedcluster"
- "azure_rm_postgresqlserver"
- "azure_rm_postgresqlflexibleserver"
- "azure_rm_privatednsrecordset"
- "azure_rm_privatednszone"
- "azure_rm_privateendpoint"
- "azure_rm_privateendpointdnszonegroup"
- "azure_rm_privatelinkservice"
- "azure_rm_privatednszonelink"
- "azure_rm_publicipaddress"
- "azure_rm_publicipprefix"
- "azure_rm_proximityplacementgroup"
- "azure_rm_rediscache"
- "azure_rm_resource"
- "azure_rm_resourcegroup"
- "azure_rm_routetable"
- "azure_rm_roleassignment"
- "azure_rm_roledefinition"
- "azure_rm_registrationassignment"
- "azure_rm_registrationdefinition"
- "azure_rm_cognitivesearch"
- "azure_rm_securitygroup"
- "azure_rm_servicebus"
- "azure_rm_sqlserver"
- "azure_rm_storageaccount"
- "azure_rm_storageblob"
- "azure_rm_storageshare"
- "azure_rm_subnet"
- "azure_rm_subscription"
- "azure_rm_trafficmanagerprofile"
- "azure_rm_virtualmachine"
- "azure_rm_virtualmachineextension"
- "azure_rm_virtualmachineimage_info"
- "azure_rm_virtualmachinescaleset"
- "azure_rm_virtualmachinesize_info"
- "azure_rm_virtualnetwork"
- "azure_rm_virtualnetworkgateway"
- "azure_rm_virtualnetworkpeering"
- "azure_rm_virtualwan"
- "azure_rm_vpnsite"
- "azure_rm_virtualhub"
- "azure_rm_virtualhubconnection"
- "azure_rm_backupazurevm"
- "azure_rm_recoveryservicesvault"
- "azure_rm_vmbackuppolicy"
- "azure_rm_webapp"
- "azure_rm_webappvnetconnection"
- "azure_rm_webappaccessrestriction"
- "azure_rm_workspace"
- "azure_rm_datafactory"
- "azure_rm_bastionhost"
- "azure_rm_devtestlab"
- "azure_rm_sqlmanagedinstance"
- "azure_rm_vmssnetworkinterface_info"
- "azure_rm_sshpublickey"
- "inventory_azure"
- "setup_azure"
trigger: none
pr:
- dev
pool:
name: pool-ubuntu-2004
jobs:
- job: CreateResourceGroups
steps:
- bash: |
echo "##vso[task.setvariable variable=resource_group;isOutput=true]ansibletest-$(uuidgen)"
echo "##vso[task.setvariable variable=resource_group_secondary;isOutput=true]ansibletest2-$(uuidgen)"
echo "##vso[task.setvariable variable=resource_group_datalake;isOutput=true]ansibletest-$(uuidgen)"
name: setvar
- bash: |
echo "Generate test resource group $(setvar.resource_group), $(setvar.resource_group_secondary), $(setvar.resource_group_datalake)"
- task: AzureCLI@2
inputs:
azureSubscription: '$(SUBSCRIPTION_FULL_NAME)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az group create -l eastus -n $(setvar.resource_group)
az group create -l eastus -n $(setvar.resource_group_secondary)
az group create -l eastus2 -n $(setvar.resource_group_datalake)
- job: RunTests
dependsOn: CreateResourceGroups
timeoutInMinutes: 180
variables:
TEST_RESOURCE_GROUP: $[ dependencies.CreateResourceGroups.outputs['setvar.resource_group'] ]
TEST_RESOURCE_GROUP_SECONDARY: $[ dependencies.CreateResourceGroups.outputs['setvar.resource_group_secondary'] ]
TEST_RESOURCE_GROUP_DATALAKE: $[ dependencies.CreateResourceGroups.outputs['setvar.resource_group_datalake'] ]
strategy:
matrix:
"Python${{ parameters.PYTHON_VER }}_sanity":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: 'sanity'
"Python${{ parameters.PYTHON_VER }}_1":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '1'
"Python${{ parameters.PYTHON_VER }}_2":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '2'
"Python${{ parameters.PYTHON_VER }}_3":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '3'
"Python${{ parameters.PYTHON_VER }}_4":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '4'
"Python${{ parameters.PYTHON_VER }}_5":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '5'
"Python${{ parameters.PYTHON_VER }}_6":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '6'
"Python${{ parameters.PYTHON_VER }}_7":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '7'
"Python${{ parameters.PYTHON_VER }}_9":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '9'
"Python${{ parameters.PYTHON_VER }}_10":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '10'
"Python${{ parameters.PYTHON_VER }}_11":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '11'
"Python${{ parameters.PYTHON_VER }}_12":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '12'
"Python${{ parameters.PYTHON_VER }}_13":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '13'
"Python${{ parameters.PYTHON_VER }}_14":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '14'
"Python${{ parameters.PYTHON_VER }}_15":
python.version: '${{ parameters.PYTHON_VER }}'
test.key: '15'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- script: tests/utils/ado/ado.sh $(test.key) ${{ parameters.PYTHON_VER }} ${{ parameters.ANSIBLE_VER }} ${{ parameters.MODULE_NAME }}
env:
SHIPPABLE_BUILD_DIR: $(Build.Repository.LocalPath)
AZURE_CLIENT_ID: $(AZURE_CLIENT_ID)
AZURE_SECRET: $(AZURE_SECRET)
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
AZURE_SUBSCRIPTION_SEC_ID: $(AZURE_SUBSCRIPTION_SEC_ID)
AZURE_TENANT: $(AZURE_TENANT)
AZURE_PRINCIPAL_ID: $(AZURE_PRINCIPAL_ID)
AZURE_MANAGED_BY_TENANT_ID: $(AZURE_MANAGED_BY_TENANT_ID)
AZURE_ROLE_DEFINITION_ID: $(AZURE_ROLE_DEFINITION_ID)
RESOURCE_GROUP: $(TEST_RESOURCE_GROUP)
RESOURCE_GROUP_SECONDARY: $(TEST_RESOURCE_GROUP_SECONDARY)
RESOURCE_GROUP_DATALAKE: $(TEST_RESOURCE_GROUP_DATALAKE)
displayName: 'Running Tests'
- job: CleanupResourceGroups
dependsOn:
- CreateResourceGroups
- RunTests
condition: always()
variables:
TEST_RESOURCE_GROUP: $[ dependencies.CreateResourceGroups.outputs['setvar.resource_group'] ]
TEST_RESOURCE_GROUP_SECONDARY: $[ dependencies.CreateResourceGroups.outputs['setvar.resource_group_secondary'] ]
TEST_RESOURCE_GROUP_DATALAKE: $[ dependencies.CreateResourceGroups.outputs['setvar.resource_group_datalake'] ]
steps:
- task: AzureCLI@2
inputs:
azureSubscription: '$(SUBSCRIPTION_FULL_NAME)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az group delete -n $(TEST_RESOURCE_GROUP) --yes --no-wait
az group delete -n $(TEST_RESOURCE_GROUP_SECONDARY) --yes --no-wait
az group delete -n $(TEST_RESOURCE_GROUP_DATALAKE) --yes --no-wait