forked from cloud-custodian/cloud-custodian
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
live-functional.yml
131 lines (107 loc) · 4.33 KB
/
live-functional.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
trigger: none
schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build
branches:
include:
- master
always: true
variables:
- group: AzureLiveTests
stages:
- stage: azure_live_functional
displayName: Azure Live Functional Tests
jobs:
- job: 'azure_nightly_test_run'
displayName: 'Azure Nightly Test Run'
timeoutInMinutes: 0
cancelTimeoutInMinutes: 0
pool:
vmImage: 'Ubuntu-16.04'
steps:
- checkout: self
fetchDepth: 1
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'
- script: python -m pip install --upgrade pip && pip install . && pip install -r requirements-dev.txt
displayName: "Install Dependencies"
- script: az login --service-principal -u ${AZURE_CLIENT_ID} -p ${AZURE_CLIENT_SECRET} --tenant ${AZURE_TENANT_ID} && az account set -s ${AZURE_SUBSCRIPTION_ID}
displayName: "Login to Azure"
env:
AZURE_CLIENT_ID: $(azure-client-id)
AZURE_CLIENT_SECRET: $(azure-client-secret)
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(azure-tenant-id)
# Skip some resources due to some restrictions with their provisioning using Service Principal account
# We maintain those resources in the test subscription available for the tests
- script: tools/c7n_azure/tests/templates/provision.sh --skip keyvault cost-management-export containerservice databricks
displayName: "Provision Azure Resources"
env:
AZURE_CLIENT_ID: $(azure-client-id)
AZURE_CLIENT_SECRET: $(azure-client-secret)
- script: C7N_TEST_RUN=true C7N_FUNCTIONAL=yes pytest -v -m "not skiplive" tools/c7n_azure/tests
displayName: "Run Azure tests without cassettes"
- script: tools/c7n_azure/tests/templates/cleanup.sh --skip keyvault cost-management-export containerservice databricks
displayName: "Cleanup Azure Resources"
condition: always()
- job: 'azure_nightly_functions_test'
displayName: 'Azure Functions Nightly Test'
timeoutInMinutes: 0
cancelTimeoutInMinutes: 0
pool:
vmImage: 'Ubuntu-16.04'
steps:
- checkout: self
fetchDepth: 1
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'
- script: python -m pip install --upgrade pip && pip install . && pip install -r requirements-dev.txt
displayName: "Install Dependencies"
- script: ./test_functions.sh
workingDirectory: tools/c7n_azure/tests/azure-functions
displayName: "Run Azure Functions Test"
env:
AZURE_CLIENT_ID: $(azure-client-id)
AZURE_CLIENT_SECRET: $(azure-client-secret)
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(azure-tenant-id)
# If all functional test stages complete successfully then
# push a docker image and tag `nightly`.
- stage: post_success
displayName: After Successful Functional Tests
dependsOn: azure_live_functional
jobs:
- job: 'push_docker_nightly'
displayName: 'Push Nightly Docker Image'
pool:
vmImage: 'Ubuntu-16.04'
steps:
- bash: |
printf -v TAG_DATE '%(%Y%m%d)T\n' -1
echo "##vso[task.setvariable variable=TAG_DATE]$TAG_DATE"
# C7N
- task: Docker@2
displayName: Build and Push C7N Nightly
inputs:
command: buildAndPush
Dockerfile: Dockerfile
containerRegistry: dockerServiceConnection
repository: cloudcustodian/c7n
tags: |
nightly
$(TAG_DATE)-nightly
# Mailer
- task: Docker@2
displayName: Build and Push Mailer Nightly
inputs:
command: buildAndPush
Dockerfile: tools/c7n_mailer/Dockerfile
containerRegistry: dockerServiceConnection
repository: cloudcustodian/mailer
tags: |
nightly
$(TAG_DATE)-nightly