-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
81 lines (75 loc) · 2.44 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
trigger:
- master
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
imageRepo: myflagacr3210
urlRepo: myflagacr3210.azurecr.io
secretACR: k8ssecret5
stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: Docker@2
displayName: Build an image
inputs:
containerRegistry: 'acr-srv-project-y'
repository: '$(imageRepo)'
command: 'buildAndPush'
Dockerfile: '$(Build.SourcesDirectory)/result/Dockerfile'
tags: '$(tag)'
- task: Docker@2
inputs:
containerRegistry: 'acr-srv-project-y'
repository: '$(imageRepo)'
command: 'buildAndPush'
Dockerfile: '$(Build.SourcesDirectory)/vote/Dockerfile'
tags: '$(tag)'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)/s/k8s-specifications'
artifact: 'manifests'
publishLocation: 'pipeline'
- stage: Deployment
jobs:
- deployment: deploytoAks
pool:
vmImage: 'ubuntu-latest'
environment: 'project-y-ENV.project-y'
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'manifests'
itemPattern:
targetPath: '$(Pipeline.Workspace)/manifests'
- task: KubernetesManifest@0
inputs:
action: 'createSecret'
namespace: 'project-y'
secretType: 'dockerRegistry'
secretName: '$(secretACR)'
dockerRegistryEndpoint: 'acr-srv-project-y'
- task: KubernetesManifest@0
inputs:
action: 'deploy'
namespace: 'project-y'
manifests: |
$(Pipeline.Workspace)/manifests/postgres-deploy.yaml
$(Pipeline.Workspace)/manifests/postgres-service.yaml
$(Pipeline.Workspace)/manifests/redis-deploy.yaml
$(Pipeline.Workspace)/manifests/redis-service.yaml
$(Pipeline.Workspace)/manifests/result-app-deploy.yaml
$(Pipeline.Workspace)/manifests/result-app-service.yaml
$(Pipeline.Workspace)/manifests/voting-app-deploy.yaml
$(Pipeline.Workspace)/manifests/voting-app-service.yaml
containers: '$(urlRepo)/$(imageRepo)/$(tag)'