-
Notifications
You must be signed in to change notification settings - Fork 7
/
cloudbuild.yaml
121 lines (115 loc) · 3.8 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
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
steps:
- name: "node:$_NODE_VERSION"
id: yarn_install_and_build
dir: eq-author
entrypoint: /bin/bash
args:
- "-c"
- |
if [ $_ENV = "staging" ]; then
yarn install
yarn build
else
echo "*************************************************************"
echo "* Yarn install and build not required *"
echo "*************************************************************"
fi
- name: docker
id: build_and_push_author
dir: eq-author
entrypoint: sh
waitFor:
- yarn_install_and_build
args:
- "-c"
- |
if [ $_ENV = "staging" ]; then
docker build -t "$_EQ_AUTHOR_IMAGE_REPO:$SHORT_SHA" .
docker push "$_EQ_AUTHOR_IMAGE_REPO:$SHORT_SHA"
else
echo "*************************************************************"
echo "* Build not required *"
echo "*************************************************************"
fi
- name: docker
id: build_and_push_author_api
dir: eq-author-api
entrypoint: sh
waitFor:
- "-"
args:
- "-c"
- |
if [ $_ENV = "staging" ]; then
docker build -t "$_EQ_AUTHOR_API_IMAGE_REPO:$SHORT_SHA" .
docker push "$_EQ_AUTHOR_API_IMAGE_REPO:$SHORT_SHA"
else
echo "*************************************************************"
echo "* Build not required *"
echo "*************************************************************"
fi
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:alpine"
id: tag_author_release
entrypoint: /bin/bash
args:
- "-c"
- |
if [ $_ENV = "preprod" ]; then
gcloud container images add-tag \
$_EQ_AUTHOR_IMAGE_REPO:$SHORT_SHA \
$_EQ_AUTHOR_IMAGE_REPO:$TAG_NAME
else
echo "*************************************************************"
echo "* Tagging not required *"
echo "*************************************************************"
fi
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:alpine"
id: tag_author_api_release
entrypoint: /bin/bash
args:
- "-c"
- |
if [ $_ENV = "preprod" ]; then
gcloud container images add-tag \
$_EQ_AUTHOR_API_IMAGE_REPO:$SHORT_SHA \
$_EQ_AUTHOR_API_IMAGE_REPO:$TAG_NAME
else
echo "*************************************************************"
echo "* Tagging not required *"
echo "*************************************************************"
fi
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:alpine"
id: deploy_author_api
entrypoint: sh
args:
- "-c"
- |
if [ $_ENV = "staging" ]; then
gcloud run deploy eq-author-api \
--image "$_EQ_AUTHOR_API_IMAGE_REPO:$SHORT_SHA" \
--region europe-west2 \
--platform managed
else
gcloud run deploy eq-author-api \
--image "$_EQ_AUTHOR_API_IMAGE_REPO:$TAG_NAME" \
--region europe-west2 \
--platform managed
fi
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:alpine"
id: deploy_author
entrypoint: sh
args:
- "-c"
- |
if [ $_ENV = "staging" ]; then
gcloud run deploy eq-author \
--image "$_EQ_AUTHOR_IMAGE_REPO:$SHORT_SHA" \
--region europe-west2 \
--platform managed
else
gcloud run deploy eq-author \
--image "$_EQ_AUTHOR_IMAGE_REPO:$TAG_NAME" \
--region europe-west2 \
--platform managed
fi
timeout: 1800s