-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
82 lines (79 loc) · 2.9 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#steps:
# - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
# id: 'Build Image'
# entrypoint: gcloud
# args:
# - 'builds'
# - 'submit'
# - '--tag'
# - 'asia-south1-docker.pkg.dev/$PROJECT_ID/gcloud-run-example-repo/gcloud-run-example-img:latest'
# - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
# id: 'Deploy Image'
# entrypoint: gcloud
# args:
# - 'run'
# - 'deploy'
# - 'gcloud-run-example-service'
# - '--image'
# - 'asia-south1-docker.pkg.dev/$PROJECT_ID/gcloud-run-example-repo/gcloud-run-example-img:latest'
# - '--region'
# - 'asia-south1'
# - '--platform'
# - 'managed'
# - '--allow-unauthenticated'
# - '--set-env-vars'
# - 'REDIS_URL={_REDIS_URL},REDIS_PASSWD={_REDIS_PASSWD},AGE={_AGE}'
# secretEnv:
# - 'REDIS_URL'
# - 'REDIS_PASSWD'
# - 'AGE'
#availableSecrets:
# secretManager:
# - versionName: 'projects/learning-cloud-build-101/secrets/EXAMPLE_REDIS_URL/versions/latest'
# env: 'REDIS_URL'
# - versionName: 'projects/learning-cloud-build-101/secrets/EXAMPLE_REDIS_PASSWD/versions/latest'
# env: 'REDIS_PASSWD'
# - versionName: 'projects/learning-cloud-build-101/secrets/EXAMPLE_AGE/versions/latest'
# env: 'AGE'
steps:
- name: 'gcr.io/cloud-builders/gcloud'
id: 'Build Image'
args:
- 'builds'
- 'submit'
- '--tag'
- 'asia-south1-docker.pkg.dev/$PROJECT_ID/gcloud-run-example-repo/gcloud-run-example-img:latest'
- name: 'gcr.io/cloud-builders/gcloud'
id: 'Set Env & Deploy Image'
entrypoint: 'bash'
args:
- '-c'
- |-
gcloud run deploy gcloud-run-example-service \
--image asia-south1-docker.pkg.dev/$PROJECT_ID/gcloud-run-example-repo/gcloud-run-example-img:latest \
--region asia-south1 \
--platform managed \
--allow-unauthenticated \
--set-env-vars REDIS_URL=$$REDIS_URL,REDIS_PASSWD=$$REDIS_PASSWD,AGE=$$AGE
secretEnv: ['REDIS_URL', 'REDIS_PASSWD', 'AGE']
availableSecrets:
secretManager:
- versionName: 'projects/learning-cloud-build-101/secrets/EXAMPLE_REDIS_URL/versions/latest'
env: 'REDIS_URL'
- versionName: 'projects/learning-cloud-build-101/secrets/EXAMPLE_REDIS_PASSWD/versions/latest'
env: 'REDIS_PASSWD'
- versionName: 'projects/learning-cloud-build-101/secrets/EXAMPLE_AGE/versions/latest'
env: 'AGE'
#steps:
# - name: 'bash'
# id: 'Do Bash'
# args: ['-c', 'echo $$REDIS_URL $$REDIS_PASSWD $$AGE']
# secretEnv: ['REDIS_URL', 'REDIS_PASSWD', 'AGE']
#availableSecrets:
# secretManager:
# - versionName: 'projects/learning-cloud-build-101/secrets/EXAMPLE_REDIS_URL/versions/latest'
# env: 'REDIS_URL'
# - versionName: 'projects/learning-cloud-build-101/secrets/EXAMPLE_REDIS_PASSWD/versions/latest'
# env: 'REDIS_PASSWD'
# - versionName: 'projects/learning-cloud-build-101/secrets/EXAMPLE_AGE/versions/latest'
# env: 'AGE'