-
Notifications
You must be signed in to change notification settings - Fork 10
/
azure-pipelines.yml
191 lines (173 loc) · 6.04 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
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
stages:
- stage: BuildBackendServices
pool:
vmImage: ubuntu-latest
jobs:
- job: BuildDotnetBackend
steps:
- task: DotNetCoreCLI@2
name: BuildDotNetApp
inputs:
command: 'build'
projects: '**/MyFirstAzureWebApp/MyFirstAzureWebApp.csproj'
- task: DotNetCoreCLI@2
name: PublishDotNetApp
inputs:
command: 'publish'
publishWebProjects: true
- task: AzureWebApp@1
name: DeploytoWebApp
inputs:
azureSubscription: 'sub-06(82fec995-d706-4757-a002-6bfc2d89631a)'
appType: 'webApp'
appName: 'mf01dev'
package: '$(System.DefaultWorkingDirectory)/**/*.zip'
deploymentMethod: 'zipDeploy'
- job: BuildDocker_SalesBookLB
displayName: BuildDockerService-SalesBook.LB
steps:
- task: Docker@2
inputs:
command: 'buildAndPush'
Dockerfile: '**/SalesBook.LB/Dockerfile'
containerRegistry: 'sub06-meritoacrmf'
repository: 'SalesBook.LB'
tags: |
latest
$(Build.SourceVersion)
- job: BuildDocker_SalesBookWEB
displayName: BuildDockerService-SalesBook.WEB
steps:
- task: Docker@2
inputs:
command: 'buildAndPush'
Dockerfile: '**/SalesBook.WEB/Dockerfile'
containerRegistry: 'sub06-meritoacrmf'
repository: 'SalesBook.WEB'
tags: |
latest
$(Build.SourceVersion)
- stage: PushImages
pool:
vmImage: ubuntu-latest
jobs:
- job: listAllImages
condition: succeeded()
steps:
- script: docker images
- stage: DeployToAKS
pool:
vmImage: ubuntu-latest
jobs:
- job: pushToK8s
displayName: pushToK8s
steps:
- task: KubernetesManifest@1
inputs:
action: 'deploy'
connectionType: 'kubernetesServiceConnection'
kubernetesServiceConnection: 'aks01-serviceconnection'
manifests: '**/AKS/deployment.yaml'
- stage: changeTMconf
pool:
vmImage: ubuntu-latest
jobs:
- job: increasTrafficManager0
displayName: increasTrafficManager0
steps:
- script: echo "Deploying to development environment..."
displayName: 'Deploy to Dev'
- task: AzureCLI@2
inputs:
azureSubscription: 'sub-06(82fec995-d706-4757-a002-6bfc2d89631a)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name ab1 --weight 100 --type azureEndpoints
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name ab2 --weight 50 --type azureEndpoints
useGlobalConfig: true
- job: waitForNext
displayName: waitForNext
dependsOn: increasTrafficManager0
pool: server
steps:
- task: Delay@1
inputs:
delayForMinutes: '1' # Adjust the delay time as needed
- job: increasTrafficManager1
dependsOn: waitForNext
displayName: increasTrafficManager1
steps:
- script: echo "Deploying to development environment..."
displayName: 'Deploy to Dev'
- task: AzureCLI@2
inputs:
azureSubscription: 'sub-06(82fec995-d706-4757-a002-6bfc2d89631a)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name ab1 --weight 100 --type azureEndpoints
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name ab2 --weight 100 --type azureEndpoints
useGlobalConfig: true
- job: waitForNext1
pool: server
displayName: waitForNext1
dependsOn: increasTrafficManager1
steps:
- task: Delay@1
inputs:
delayForMinutes: '1' # Adjust the delay time as needed
- job: increasTrafficManager2
displayName: increasTrafficManager2
dependsOn: waitForNext1
steps:
- script: echo "Deploying to development environment..."
displayName: 'Deploy to Dev'
- task: AzureCLI@2
inputs:
azureSubscription: 'sub-06(82fec995-d706-4757-a002-6bfc2d89631a)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name ab1 --weight 100 --type azureEndpoints
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name ab2 --weight 200 --type azureEndpoints
useGlobalConfig: true
- job: waitForNext2
pool: server
displayName: waitForNext2
dependsOn: increasTrafficManager2
steps:
- task: Delay@1
inputs:
delayForMinutes: '1' # Adjust the delay time as needed
- job: increasTrafficManager3
displayName: increasTrafficManager3
dependsOn: waitForNext2
steps:
- script: echo "Deploying to development environment..."
displayName: 'Deploy to Dev'
- task: AzureCLI@2
inputs:
azureSubscription: 'sub-06(82fec995-d706-4757-a002-6bfc2d89631a)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name ab1 --weight 50 --type azureEndpoints
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name ab2 --weight 900 --type azureEndpoints
useGlobalConfig: true
- stage: testing
variables:
- group: secrets
pool:
vmImage: ubuntu-latest
jobs:
- job: testing
displayName: testing
steps:
- script: echo "Deploying to development environment..." $(SKIPDEPLOYMENT)
- script: echo $(dockerPassword)
- script: echo $(dockerUserName)
- script: |
docker login -u $(dockerUserName) -p $(dockerPassword)
docker image tag alpine:3.18 mifurm/alpinecustom:$(Build.BuildId)
docker push mifurm/alpinecustom:$(Build.BuildId)