-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcloudbuild.yaml
90 lines (82 loc) · 2.28 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
83
84
85
86
87
88
89
90
steps:
- id: "build image"
name: "gcr.io/cloud-builders/docker"
args: ["build", "-t", "${_ARTIFACT_REGISTRY_REPOSITORY}/${_SERVICE_NAME}", "./alteredbuilder/"]
- id: "push image"
name: "gcr.io/cloud-builders/docker"
args: ["push", "${_ARTIFACT_REGISTRY_REPOSITORY}/${_SERVICE_NAME}"]
- id: "run tests"
name: "gcr.io/google-appengine/exec-wrapper"
args:
[
"-i",
"${_ARTIFACT_REGISTRY_REPOSITORY}/${_SERVICE_NAME}",
"-s",
"${_CLOUD_SQL_CONNECTION_NAME}",
"-e",
"SETTINGS_NAME=${_SECRET_SETTINGS_NAME}",
"--",
"coverage",
"run",
"manage.py",
"test",
]
- id: "apply migrations"
name: "gcr.io/google-appengine/exec-wrapper"
args:
[
"-i",
"${_ARTIFACT_REGISTRY_REPOSITORY}/${_SERVICE_NAME}",
"-s",
"${_CLOUD_SQL_CONNECTION_NAME}",
"-e",
"SETTINGS_NAME=${_SECRET_SETTINGS_NAME}",
"--",
"python",
"manage.py",
"migrate",
]
- id: "collect static"
name: "gcr.io/google-appengine/exec-wrapper"
args:
[
"-i",
"${_ARTIFACT_REGISTRY_REPOSITORY}/${_SERVICE_NAME}",
"-s",
"${_CLOUD_SQL_CONNECTION_NAME}",
"-e",
"SETTINGS_NAME=${_SECRET_SETTINGS_NAME}",
"-e",
"USE_GCS_STATICS=True",
"--",
"python",
"manage.py",
"collectstatic",
"--no-input",
]
- id: "deploy application"
name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
[
'run', 'deploy', '${_SERVICE_NAME}',
'--image', '${_ARTIFACT_REGISTRY_REPOSITORY}/${_SERVICE_NAME}',
'--region', '${_REGION}',
'--platform', 'managed',
'--port', '8000',
'--add-cloudsql-instances', '${_CLOUD_SQL_CONNECTION_NAME}',
'--allow-unauthenticated',
'--service-account', '${_CLOUD_RUN_SA}',
'--cpu', '1000m',
'--memory', '256Mi',
'--update-env-vars', 'COMMIT_ID=${SHORT_SHA}'
]
images:
- "${_ARTIFACT_REGISTRY_REPOSITORY}/${_SERVICE_NAME}"
options:
logging: CLOUD_LOGGING_ONLY
# substitutions:
# _ARTIFACT_REGISTRY_REPOSITORY:
# _SERVICE_NAME:
# _CLOUD_SQL_CONNECTION_NAME:
# _SECRET_SETTINGS_NAME: