-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathazure-pipelines.yml
158 lines (153 loc) · 5.58 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
# (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC.
# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
batch: true
branches:
include:
- master
- develop
## Reference to repository containing common templates and variables
resources:
repositories:
- repository: templates
type: git
name: APPLICATIONS/tdo-azure-devops-templates
variables:
## Import of common variables
- template: variables/pmap-common.yml@templates # Template reference
- group: "nlp_annotator"
# appReleaseName is the name of helm release
- name: appReleaseName
value: "pine"
- name: helmChart
value: "pine-chart"
- name: redisImageName
value: "pine/redis"
- name: eveImageName
value: "pine/eve"
- name: backendImageName
value: "pine/backend"
- name: frontendImageName
value: "pine/frontend"
- name: pipelineImageName
value: "pine/al_pipeline"
stages:
- stage: build_test
displayName: Build and Test
jobs:
- job: build_test
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push Pine Redis image to container registry
inputs:
command: buildAndPush
repository: $(redisImageName)
dockerfile: redis/Dockerfile
containerRegistry: $(containerRegistry)
tags: |
$(Build.BuildId)
- task: Docker@2
displayName: Build and push Pine Eve image to container registry
inputs:
command: buildAndPush
repository: $(eveImageName)
dockerfile: eve/Dockerfile
containerRegistry: $(containerRegistry)
tags: |
$(Build.BuildId)
- task: Docker@2
displayName: Build and push Pine Backend image to container registry
inputs:
command: buildAndPush
repository: $(backendImageName)
dockerfile: backend/Dockerfile
containerRegistry: $(containerRegistry)
tags: |
$(Build.BuildId)
- task: Docker@2
displayName: Build and push Pine Frontend image to container registry
inputs:
command: buildAndPush
repository: $(frontendImageName)
dockerfile: frontend/annotation/Dockerfile
containerRegistry: $(containerRegistry)
tags: |
$(Build.BuildId)
- task: Docker@2
displayName: Build and push Pine al_pipeline image to container registry
inputs:
command: buildAndPush
repository: $(pipelineImageName)
dockerfile: pipelines/Dockerfile
buildContext: pipelines/
containerRegistry: $(containerRegistry)
tags: |
$(Build.BuildId)
- task: PublishPipelineArtifact@1
inputs:
targetPath: 'pine-chart'
artifact: 'pine-chart'
publishLocation: 'pipeline'
- stage: deploy_to_dev
displayName: Deploy to dev
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/develop'))
dependsOn: build_test
jobs:
- template: azure-pipeline-templates/deploy.yml # Template reference
parameters:
appReleaseName: $(appReleaseName)
appUrl: "dev-nlpannotator.pm.jh.edu"
deployEnvironment: $(devEnvironmentV2)
kubeServiceConnection: $(devEnvironmentV2)
namespace: $(devNamespace)
imageTag: $(Build.BuildId)
redisImageName: $(redisImageName)
eveImageName: $(eveImageName)
backendImageName: $(backendImageName)
frontendImageName: $(frontendImageName)
pipelineImageName: $(pipelineImageName)
secrets:
backend:
VEGAS_SERVER: https://slife.jh.edu
VEGAS_CLIENT_ID: 1976d9d4-be86-44ce-aa0f-c5a4b295c701
VEGAS_CLIENT_SECRET: $(vegas-client-secret-dev)
BACKEND_SECRET_KEY: $(backend-secret-key-dev)
eve:
MONGO_URI: $(mongo-uri-dev)
azure-secret:
azurestorageaccountname: $(azure-storage-account-name-dev)
azurestorageaccountkey: $(azure-storage-account-key-dev)
- stage: deploy_to_prod
displayName: Deploy to prod
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))
dependsOn: build_test
jobs:
- template: azure-pipeline-templates/deploy.yml # Template reference
parameters:
appReleaseName: $(appReleaseName)
appUrl: "nlpannotator.pm.jh.edu"
deployEnvironment: $(prodEnvironment)
kubeServiceConnection: $(prodEnvironment)
namespace: $(prodNamespace)
imageTag: $(Build.BuildId)
redisImageName: $(redisImageName)
eveImageName: $(eveImageName)
backendImageName: $(backendImageName)
frontendImageName: $(frontendImageName)
pipelineImageName: $(pipelineImageName)
secrets:
backend:
VEGAS_SERVER: https://my.jh.edu
VEGAS_CLIENT_ID: b7590f07-cbd9-48b1-82f4-8aab02470831
VEGAS_CLIENT_SECRET: $(vegas-client-secret-prod)
BACKEND_SECRET_KEY: $(backend-secret-key-prod)
eve:
MONGO_URI: $(mongo-uri-prod)
azure-secret:
azurestorageaccountname: $(azure-storage-account-name-prod)
azurestorageaccountkey: $(azure-storage-account-key-prod)