-
Notifications
You must be signed in to change notification settings - Fork 10
/
multiStagePipeline.yml
142 lines (129 loc) · 4.77 KB
/
multiStagePipeline.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
stages:
- stage: BuildServices
pool:
vmImage: ubuntu-latest
jobs:
- job: BuildDocker_SalesBookLB
displayName: Build Docker Image for SalesBook.LB app
steps:
- task: Docker@2
inputs:
containerRegistry: 'meritomf01SvcConnection'
repository: 'SalesBook.LB'
command: 'buildAndPush'
Dockerfile: '**/SalesBook.LB/Dockerfile'
tags: |
$(Build.BuildId)
latest
- job: BuildDocker_SalesBookWEB
displayName: Build Docker Image for SalesBook.WEB app
steps:
- task: Docker@2
inputs:
containerRegistry: 'meritomf01SvcConnection'
repository: 'SalesBook.WEB'
command: 'buildAndPush'
Dockerfile: '**/SalesBook.WEB/Dockerfile'
tags: |
$(Build.BuildId)
latest
- stage: DeploytoAKS
pool:
vmImage: ubuntu-latest
jobs:
- job: DeploytoAKS
displayName: Deploy to AKS
steps:
- task: KubernetesManifest@1
inputs:
action: 'deploy'
connectionType: 'kubernetesServiceConnection'
kubernetesServiceConnection: 'aks01mfSvcConnection'
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 e1 --weight 800 --type azureEndpoints
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name e2 --weight 100 --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 e1 --weight 600 --type azureEndpoints
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name e2 --weight 300 --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 e1 --weight 300 --type azureEndpoints
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name e2 --weight 600 --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 100 --type azureEndpoints
az network traffic-manager endpoint update --resource-group global-net-rg --profile-name tfmeritomf --name ab2 --weight 900 --type azureEndpoints
useGlobalConfig: true