-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
65 lines (60 loc) · 1.63 KB
/
cloudbuild.yaml
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
steps:
- name: gcr.io/cloud-builders/docker
id: 'build-container-image'
args:
- 'build'
- '--no-cache'
- '-t'
- 'gcr.io/$_REPO_PROJ_ID/rebred:latest'
- '.'
waitFor: ['-']
- name: gcr.io/cloud-builders/docker
id: 'push-container-image'
args:
- 'push'
- 'gcr.io/$_REPO_PROJ_ID/rebred:latest'
waitFor: ['build-container-image']
- name: gcr.io/cloud-builders/gcloud-slim
id: 'deploy'
args:
- 'run'
- 'services'
- 'update'
- 'rebred'
- '--platform=managed'
- '--image=gcr.io/$_REPO_PROJ_ID/rebred:latest'
- '--region=us-central1'
- '--set-env-vars=${_ENV1},${_ENV2}'
- '--quiet'
waitFor: ['push-container-image']
- name: gcr.io/cloud-builders/gcloud-slim
id: 'redirect-traffic'
args:
- 'run'
- 'services'
- 'update-traffic'
- 'rebred'
- '--to-latest'
- '--platform=managed'
- '--region=us-central1'
waitFor: ['deploy']
- name: gcr.io/cloud-builders/git
id: 'drop-cache'
entrypoint: 'bash'
args:
- '-c'
- |
curl -X POST "https://api.cloudflare.com/client/v4/zones/$$CLOUDFLARE_API_ZONE/purge_cache" \
-H "X-Auth-Email: $_CLOUDFLARE_EMAIL_ADDRESS" \
-H "X-Auth-Key: $$CLOUDFLARE_API_KEY" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
secretEnv: ['CLOUDFLARE_API_KEY', 'CLOUDFLARE_API_ZONE']
availableSecrets:
secretManager:
- versionName: projects/546950964653/secrets/cloudflare_api_key/versions/2
env: 'CLOUDFLARE_API_KEY'
- versionName: projects/546950964653/secrets/cloudflare_api_zone/versions/1
env: 'CLOUDFLARE_API_ZONE'
images:
- 'gcr.io/$_REPO_PROJ_ID/rebred'