-
Notifications
You must be signed in to change notification settings - Fork 34
/
cloudbuild.yaml
65 lines (56 loc) · 1.78 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:
- id: copy_env_file
name: "ubuntu"
entrypoint: "bash"
args: ["-c", "cp .env.example .env"]
waitFor: ['-']
- id: pull_backend_cache
name: 'gcr.io/cloud-builders/docker'
args: ['pull', '${_BACKEND_IMAGE}:${_CACHE_TAG}']
waitFor: ['-']
- id: pull_frontend_cache
name: 'gcr.io/cloud-builders/docker'
args: ['pull', '${_FRONTEND_IMAGE}:${_CACHE_TAG}']
waitFor: ['-']
- id: build_backend
name: 'docker/compose:1.24.1'
args: ['build', 'backend']
env:
- 'BACKEND_CACHE_IMAGE=${_BACKEND_IMAGE}:${_CACHE_TAG}'
waitFor: ['copy_env_file', 'pull_backend_cache']
- id: build_frontend
name: 'docker/compose:1.24.1'
args: ['build', 'frontend']
env:
- 'FRONTEND_CACHE_IMAGE=${_FRONTEND_IMAGE}:${_CACHE_TAG}'
waitFor: ['copy_env_file', 'pull_frontend_cache']
- id: run_containers
name: 'docker/compose:1.24.1'
args: ['up', '--no-build', '--scale', 'proxy=0', '-d']
env:
- 'COMPOSE_HTTP_TIMEOUT=200'
waitFor: ['build_backend', 'build_frontend']
- id: wait_for_backend
name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
until [ "$(docker inspect -f {{.State.Health.Status}} backend)" == "healthy" ]; do
echo "Wait for backend health check ..."
sleep 5
done
waitFor: ['run_containers']
timeout: 300s
- id: test_code_style
name: 'gcr.io/cloud-builders/docker'
args: ['exec', 'backend', 'flake8', '--exclude=migrations', '--ignore=E121,E226,E402,E501,F401,W503', './']
waitFor: ['wait_for_backend']
- id: test_backend
name: 'gcr.io/cloud-builders/docker'
args: ['exec', 'backend', 'python', 'manage.py', 'test', '--exclude-tag=mail']
waitFor: ['wait_for_backend']
substitutions:
_BACKEND_IMAGE: froggytaipei/froggy-service-api
_FRONTEND_IMAGE: froggytaipei/froggy-service-nginx
_CACHE_TAG: latest