-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
139 lines (130 loc) · 5.55 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
137
138
139
variables:
- group: demo-vm-deploy
trigger:
- andrei
- stefan
stages:
- stage: Build
displayName: Build and Validate
jobs:
- job: Validate
pool:
vmImage: 'ubuntu-latest'
steps:
- task: AzureResourceGroupDeployment@2
displayName: validate lab template
inputs:
azureSubscription: $(testAzureConnection)
resourceGroupName: $(testResourceGroupName)
templateLocation: 'Linked artifact'
csmFile: $(Build.SourcesDirectory)/lab/azuredeploy.json
csmParametersFile: $(Build.SourcesDirectory)/lab/azuredeploy.parameters.json
deploymentMode: 'Validation'
- task: AzureResourceGroupDeployment@2
displayName: validate vm template
inputs:
azureSubscription: $(testAzureConnection)
resourceGroupName: $(testResourceGroupName)
templateLocation: 'Linked artifact'
csmFile: $(Build.SourcesDirectory)/vm/azuredeploy.json
csmParametersFile: $(Build.SourcesDirectory)/vm/azuredeploy.parameters.json
deploymentMode: 'Validation'
- task: AzureResourceGroupDeployment@2
displayName: validate env template
inputs:
azureSubscription: $(testAzureConnection)
resourceGroupName: $(testResourceGroupName)
templateLocation: 'Linked artifact'
csmFile: $(Build.SourcesDirectory)/Environments/PresalesDemo/azuredeploy.json
csmParametersFile: $(Build.SourcesDirectory)/Environments/PresalesDemo/presales.parameters.json
deploymentMode: 'Validation'
- task: AzureResourceGroupDeployment@2
displayName: validate env template
inputs:
azureSubscription: $(testAzureConnection)
resourceGroupName: $(testResourceGroupName)
templateLocation: 'Linked artifact'
csmFile: $(Build.SourcesDirectory)/Environments/TestingAutomation/azuredeploy.json
csmParametersFile: $(Build.SourcesDirectory)/Environments/TestingAutomation/testing.parameters.json
deploymentMode: 'Validation'
- publish: $(Build.SourcesDirectory)
artifact: drop
displayName: Publish all sources
- stage: DeployDevUat
displayName: Deploy dev branch to UAT
dependsOn: Build
condition: and( succeeded(), not( eq( variables['Build.Reason'], 'PullRequest')))
jobs:
- deployment: deployDevUat
environment: uat
pool:
vmImage: 'ubuntu-latest'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: drop
displayName: Download sources
- task: AzureResourceGroupDeployment@2
displayName: deploy lab to test
inputs:
azureSubscription: $(testAzureConnection)
resourceGroupName: $(testResourceGroupName)
templateLocation: 'Linked artifact'
csmFile: $(Pipeline.Workspace)/drop/lab/azuredeploy.json
csmParametersFile: $(Pipeline.Workspace)/drop/lab/azuredeploy.parameters.json
deploymentMode: 'Incremental'
overrideParameters: -tenantId $(tenantId) -objectId $(objectId) -gitToken $(githubToken) -projectName "dsftest" -project $(projectName) -owner $(ownerEmail) -artifactBranch $(Build.SourceBranchName)
- stage: DeployPrUat
displayName: Deploy to UAT
dependsOn: Build
condition: and( succeeded(),eq( variables['system.pullRequest.targetBranch'], 'master'), eq( variables['Build.Reason'], 'PullRequest'))
jobs:
- deployment: deployPrUat
environment: uat
pool:
vmImage: 'ubuntu-latest'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: drop
displayName: Download sources
- task: AzureResourceGroupDeployment@2
displayName: deploy lab to test
inputs:
azureSubscription: $(testAzureConnection)
resourceGroupName: $(testResourceGroupName)
templateLocation: 'Linked artifact'
csmFile: $(Pipeline.Workspace)/drop/lab/azuredeploy.json
csmParametersFile: $(Pipeline.Workspace)/drop/lab/azuredeploy.parameters.json
deploymentMode: 'Incremental'
overrideParameters: -tenantId $(tenantId) -objectId $(objectId) -gitToken $(githubToken) -projectName "dsftest" -project $(projectName) -owner $(ownerEmail) -artifactBranch $(System.PullRequest.SourceBranch)
- stage: DeployProd
displayName: Deploy to Prod
dependsOn: DeployPrUat
condition: and( succeeded(),eq( variables['system.pullRequest.targetBranch'], 'master'), eq( variables['Build.Reason'], 'PullRequest'))
jobs:
- deployment: deployProd
environment: prod
pool:
vmImage: 'ubuntu-latest'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: drop
displayName: Download sources
- task: AzureResourceGroupDeployment@2
displayName: deploy lab to test
inputs:
azureSubscription: $(prodAzureConnection)
resourceGroupName: $(prodResourceGroupName)
templateLocation: 'Linked artifact'
csmFile: $(Pipeline.Workspace)/drop/lab/azuredeploy.json
csmParametersFile: $(Pipeline.Workspace)/drop/lab/azuredeploy.parameters.json
deploymentMode: 'Incremental'
overrideParameters: -tenantId $(tenantId) -objectId $(objectId) -gitToken $(githubToken) -projectName "dsfprod" -project $(projectName) -owner $(ownerEmail)