-
Notifications
You must be signed in to change notification settings - Fork 6
/
azure-pipelines.yml
203 lines (193 loc) · 9.05 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
192
193
194
195
196
197
198
199
200
201
202
203
trigger:
- develop
- master
# no PR triggers
pr: none
resources:
repositories:
- repository: go-api
type: github
endpoint: IFRCGo
name: IFRCGo/go-api
ref: ${{ variables['Build.SourceBranchName'] }}
pool:
vmImage: ubuntu-latest
jobs:
- job: 'Build'
steps:
- checkout: go-api
displayName: "Checkout go-api"
path: go-api
- bash: pip install requests==2.31.0 docker==6.1.3
displayName: "Install pinned versions of requests and docker"
- bash: pip install -v chartpress
displayName: "Install Chartpress"
- task: AzureCLI@2
displayName: "Login to ACR"
inputs:
azureSubscription: 'IFRC-GO-Kubernetes'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az acr login --name ifrcgoacr'
addSpnToEnvironment: true
useGlobalConfig: true
- bash: $(Pipeline.Workspace)/go-api/deploy/scripts/cipublish
displayName: "Build and Push"
# - bash: $(Pipeline.Workspace)/go-api/deploy/scripts/cideploy --staging
# condition: eq(variables['Build.SourceBranch'], 'refs/heads/develop')
# displayName: "Deploy Staging"
# env:
# environment: staging
# TF_VAR_username: github
# TF_VAR_subscriptionId: $(TERRAFORM_SUBSCRIPTION_ID)
# tenantId: $(TERRAFORM_TENANT_ID)
# servicePrincipalId: $(TERRAFORM_SERVICE_PRINCIPAL_ID)
# servicePrincipalKey: $(TERRAFORM_SERVICE_PRINCIPAL_KEY)
# storageAccessKey: $(TERRAFORM_STORAGE_KEY)
# subscriptionId: $(TERRAFORM_SUBSCRIPTION_ID)
# API_FQDN: $(STAGING_ADMIN_URL)
# API_ADDITIONAL_FQDN: ''
# DJANGO_SECRET_KEY: $(STAGING_DJANGO_SECRET_KEY)
# DJANGO_DB_NAME: $(STAGING_DJANGO_DB_NAME)
# DJANGO_DB_USER: $(STAGING_DJANGO_DB_USER)
# DJANGO_DB_PASS: $(STAGING_DJANGO_DB_PASS)
# DJANGO_DB_HOST: $(STAGING_DJANGO_DB_HOST)
# DJANGO_DB_PORT: $(STAGING_DJANGO_DB_PORT)
# AZURE_STORAGE_KEY: $(STAGING_AZURE_STORAGE_KEY)
# AZURE_STORAGE_ACCOUNT: $(STAGING_AZURE_STORAGE_ACCOUNT)
# EMAIL_API_ENDPOINT: $(STAGING_EMAIL_API_ENDPOINT)
# EMAIL_HOST: $(STAGING_EMAIL_HOST)
# EMAIL_PORT: $(STAGING_EMAIL_PORT)
# EMAIL_USER: $(STAGING_EMAIL_USER)
# EMAIL_PASS: $(STAGING_EMAIL_PASS)
# TEST_EMAILS: $(STAGING_TEST_EMAILS)
# AWS_TRANSLATE_ACCESS_KEY: $(STAGING_AWS_TRANSLATE_ACCESS_KEY)
# AWS_TRANSLATE_SECRET_KEY: $(STAGING_AWS_TRANSLATE_SECRET_KEY)
# AWS_TRANSLATE_REGION: $(STAGING_AWS_TRANSLATE_REGION)
# CELERY_REDIS_URL: $(STAGING_CELERY_REDIS_URL)
# CACHE_MIDDLEWARE_SECONDS: $(STAGING_CACHE_MIDDLEWARE_SECONDS)
# MOLNIX_API_BASE: $(STAGING_MOLNIX_API_BASE)
# MOLNIX_USERNAME: $(STAGING_MOLNIX_USERNAME)
# MOLNIX_PASSWORD: $(STAGING_MOLNIX_PASSWORD)
# ERP_API_ENDPOINT: $(STAGING_ERP_API_ENDPOINT)
# ERP_API_SUBSCRIPTION_KEY: $(STAGING_ERP_API_SUBSCRIPTION_KEY)
# FDRS_APIKEY: $(STAGING_FDRS_APIKEY)
# FDRS_CREDENTIAL: $(STAGING_FDRS_CREDENTIAL)
# HPC_CREDENTIAL: $(STAGING_HPC_CREDENTIAL)
# APPLICATION_INSIGHTS_INSTRUMENTATION_KEY: $(STAGING_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY)
# ELASTIC_SEARCH_HOST: $(STAGING_ELASTIC_SEARCH_HOST)
# GO_FTPHOST: $(STAGING_GO_FTPHOST)
# GO_FTPUSER: $(STAGING_GO_FTPUSER)
# GO_FTPPASS: $(STAGING_GO_FTPPASS)
# GO_DBPASS: $(STAGING_GO_DBPASS)
# APPEALS_USER: $(STAGING_APPEALS_USER)
# APPEALS_PASS: $(STAGING_APPEALS_PASS)
# FRONTEND_URL: $(STAGING_FRONTEND_URL)
# RESOURCES_DB_NAME: $(STAGING_RESOURCES_DB_NAME)
# RESOURCES_DB_SERVER: $(STAGING_RESOURCES_DB_SERVER)
# REGION: $(STAGING_REGION)
# SENTRY_DSN: $(STAGING_SENTRY_DSN)
# SENTRY_SAMPLE_RATE: $(STAGING_SENTRY_SAMPLE_RATE)
# DJANGO_READ_ONLY: $(STAGING_DJANGO_READ_ONLY)
# AUTO_TRANSLATION_TRANSLATOR: $(STAGING_AUTO_TRANSLATION_TRANSLATOR)
# IFRC_TRANSLATION_DOMAIN: $(STAGING_IFRC_TRANSLATION_DOMAIN)
# IFRC_TRANSLATION_HEADER_API_KEY: $(STAGING_IFRC_TRANSLATION_HEADER_API_KEY)
# DEBUG_EMAIL: ''
# DOCKER_HOST_IP: ''
# DJANGO_DEBUG: ''
# DJANGO_ADDITIONAL_ALLOWED_HOSTS: ''
# # TLS cert and key should be base64 encoded
# API_TLS_CRT: $(STAGING_API_TLS_CRT)
# API_TLS_KEY: $(STAGING_API_TLS_KEY)
# API_ADDITIONAL_DOMAIN_TLS_CRT: ''
# API_ADDITIONAL_DOMAIN_TLS_KEY: ''
# # Country page
# NS_CONTACT_USERNAME: $(STAGING_NS_CONTACT_USERNAME)
# NS_CONTACT_PASSWORD: $(STAGING_NS_CONTACT_PASSWORD)
# ACAPS_API_TOKEN: $(STAGING_ACAPS_API_TOKEN)
# NS_DOCUMENT_API_KEY: $(STAGING_NS_DOCUMENT_API_KEY)
# NS_INITIATIVES_API_KEY: $(STAGING_NS_INITIATIVES_API_KEY)
# NS_INITIATIVES_API_TOKEN: $(STAGING_NS_INITIATIVES_API_TOKEN)
# # JWT
# JWT_PRIVATE_KEY_BASE64_ENCODED: $(STAGING_JWT_PRIVATE_KEY_BASE64_ENCODED)
# JWT_PUBLIC_KEY_BASE64_ENCODED: $(STAGING_JWT_PUBLIC_KEY_BASE64_ENCODED)
# JWT_EXPIRE_TIMESTAMP_DAYS: $(STAGING_JWT_EXPIRE_TIMESTAMP_DAYS)
- bash: $(Pipeline.Workspace)/go-api/deploy/scripts/cideploy --production
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
displayName: "Deploy Production"
env:
environment: production
TF_VAR_username: github
TF_VAR_subscriptionId: $(TERRAFORM_SUBSCRIPTION_ID)
tenantId: $(TERRAFORM_TENANT_ID)
servicePrincipalId: $(TERRAFORM_SERVICE_PRINCIPAL_ID)
servicePrincipalKey: $(TERRAFORM_SERVICE_PRINCIPAL_KEY)
storageAccessKey: $(TERRAFORM_STORAGE_KEY)
subscriptionId: $(TERRAFORM_SUBSCRIPTION_ID)
API_FQDN: $(PRODUCTION_ADMIN_URL)
API_ADDITIONAL_FQDN: $(PRODUCTION_ADDITIONAL_URL)
DJANGO_SECRET_KEY: $(PRODUCTION_DJANGO_SECRET_KEY)
DJANGO_DB_NAME: $(PRODUCTION_DJANGO_DB_NAME)
DJANGO_DB_USER: $(PRODUCTION_DJANGO_DB_USER)
DJANGO_DB_PASS: $(PRODUCTION_DJANGO_DB_PASS)
DJANGO_DB_HOST: $(PRODUCTION_DJANGO_DB_HOST)
DJANGO_DB_PORT: $(PRODUCTION_DJANGO_DB_PORT)
AZURE_STORAGE_KEY: $(PRODUCTION_AZURE_STORAGE_KEY)
AZURE_STORAGE_ACCOUNT: $(PRODUCTION_AZURE_STORAGE_ACCOUNT)
EMAIL_API_ENDPOINT: $(PRODUCTION_EMAIL_API_ENDPOINT)
EMAIL_HOST: $(PRODUCTION_EMAIL_HOST)
EMAIL_PORT: $(PRODUCTION_EMAIL_PORT)
EMAIL_USER: $(PRODUCTION_EMAIL_USER)
EMAIL_PASS: $(PRODUCTION_EMAIL_PASS)
TEST_EMAILS: $(PRODUCTION_TEST_EMAILS)
AWS_TRANSLATE_ACCESS_KEY: $(PRODUCTION_AWS_TRANSLATE_ACCESS_KEY)
AWS_TRANSLATE_SECRET_KEY: $(PRODUCTION_AWS_TRANSLATE_SECRET_KEY)
AWS_TRANSLATE_REGION: $(PRODUCTION_AWS_TRANSLATE_REGION)
CELERY_REDIS_URL: $(PRODUCTION_CELERY_REDIS_URL)
CACHE_MIDDLEWARE_SECONDS: $(PRODUCTION_CACHE_MIDDLEWARE_SECONDS)
MOLNIX_API_BASE: $(PRODUCTION_MOLNIX_API_BASE)
MOLNIX_USERNAME: $(PRODUCTION_MOLNIX_USERNAME)
MOLNIX_PASSWORD: $(PRODUCTION_MOLNIX_PASSWORD)
ERP_API_ENDPOINT: $(PRODUCTION_ERP_API_ENDPOINT)
ERP_API_SUBSCRIPTION_KEY: $(PRODUCTION_ERP_API_SUBSCRIPTION_KEY)
FDRS_APIKEY: $(PRODUCTION_FDRS_APIKEY)
FDRS_CREDENTIAL: $(PRODUCTION_FDRS_CREDENTIAL)
HPC_CREDENTIAL: $(PRODUCTION_HPC_CREDENTIAL)
APPLICATION_INSIGHTS_INSTRUMENTATION_KEY: $(PRODUCTION_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY)
ELASTIC_SEARCH_HOST: $(PRODUCTION_ELASTIC_SEARCH_HOST)
GO_FTPHOST: $(PRODUCTION_GO_FTPHOST)
GO_FTPUSER: $(PRODUCTION_GO_FTPUSER)
GO_FTPPASS: $(PRODUCTION_GO_FTPPASS)
GO_DBPASS: $(PRODUCTION_GO_DBPASS)
APPEALS_USER: $(PRODUCTION_APPEALS_USER)
APPEALS_PASS: $(PRODUCTION_APPEALS_PASS)
FRONTEND_URL: $(PRODUCTION_FRONTEND_URL)
RESOURCES_DB_NAME: $(PRODUCTION_RESOURCES_DB_NAME)
RESOURCES_DB_SERVER: $(PRODUCTION_RESOURCES_DB_SERVER)
REGION: $(PRODUCTION_REGION)
SENTRY_DSN: $(PRODUCTION_SENTRY_DSN)
SENTRY_SAMPLE_RATE: $(PRODUCTION_SENTRY_SAMPLE_RATE)
DJANGO_READ_ONLY: $(PRODUCTION_DJANGO_READ_ONLY)
AUTO_TRANSLATION_TRANSLATOR: $(PRODUCTION_AUTO_TRANSLATION_TRANSLATOR)
IFRC_TRANSLATION_DOMAIN: $(PRODUCTION_IFRC_TRANSLATION_DOMAIN)
IFRC_TRANSLATION_HEADER_API_KEY: $(PRODUCTION_IFRC_TRANSLATION_HEADER_API_KEY)
DEBUG_EMAIL: ''
DOCKER_HOST_IP: ''
DJANGO_DEBUG: ''
DJANGO_ADDITIONAL_ALLOWED_HOSTS: $(PRODUCTION_ADDITIONAL_URL)
# TLS cert and key should be base64 encoded
API_TLS_CRT: $(PRODUCTION_API_TLS_CRT)
API_TLS_KEY: $(PRODUCTION_API_TLS_KEY)
API_ADDITIONAL_DOMAIN_TLS_CRT: $(PRODUCTION_API_ADDITIONAL_DOMAIN_TLS_CRT)
API_ADDITIONAL_DOMAIN_TLS_KEY: $(PRODUCTION_API_ADDITIONAL_DOMAIN_TLS_KEY)
# Country page
NS_CONTACT_USERNAME: $(PRODUCTION_NS_CONTACT_USERNAME)
NS_CONTACT_PASSWORD: $(PRODUCTION_NS_CONTACT_PASSWORD)
ACAPS_API_TOKEN: $(PRODUCTION_ACAPS_API_TOKEN)
NS_DOCUMENT_API_KEY: $(PRODUCTION_NS_DOCUMENT_API_KEY)
NS_INITIATIVES_API_KEY: $(PRODUCTION_NS_INITIATIVES_API_KEY)
NS_INITIATIVES_API_TOKEN: $(PRODUCTION_NS_INITIATIVES_API_TOKEN)
# JWT
JWT_PRIVATE_KEY_BASE64_ENCODED: $(PRODUCTION_JWT_PRIVATE_KEY_BASE64_ENCODED)
JWT_PUBLIC_KEY_BASE64_ENCODED: $(PRODUCTION_JWT_PUBLIC_KEY_BASE64_ENCODED)
JWT_EXPIRE_TIMESTAMP_DAYS: $(PRODUCTION_JWT_EXPIRE_TIMESTAMP_DAYS)