-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
55 lines (48 loc) · 1.47 KB
/
cloudbuild.yaml
File metadata and controls
55 lines (48 loc) · 1.47 KB
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
steps:
- name: gcr.io/cloud-builders/docker
args:
- build
- "--no-cache"
- "--build-arg"
- "ARG_GOOGLE_MAPS_API=${_GOOGLE_MAPS_API}"
- "--build-arg"
- "ARG_SENTRY_DSN=${_SENTRY_DSN}"
- "-t"
- "$_GCR_HOSTNAME/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA"
- "./src/Website"
id: Build
- name: gcr.io/cloud-builders/docker
args:
- push
- "$_GCR_HOSTNAME/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA"
id: Push
- name: "gcr.io/cloud-builders/gcloud"
entrypoint: "bash"
args:
- "-c"
- |
mkdir -p ~/.ssh
gcloud secrets versions access latest --secret=WOM_PROD_SERVER_SSH_KEY > ~/.ssh/gcloud_private_key
chmod 600 ~/.ssh/gcloud_private_key
ssh -i ~/.ssh/gcloud_private_key -o StrictHostKeyChecking=accept-new $_WOM_PROD_SERVER_USER@$_WOM_PROD_SERVER_HOST << 'ENDSSH'
cd $_WOM_PROD_SERVER_WEBSITE_PWD
git checkout main
git pull --ff-only origin main
echo "GCLOUD_WOM_WEB_IMAGE_URL=$_GCR_HOSTNAME/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA" > gcloud.env
make gcloud-deploy
ENDSSH
id: Deploy
images:
- "$_GCR_HOSTNAME/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA"
substitutions:
_GCR_HOSTNAME: eu.gcr.io
_SERVICE_NAME: wom-web
_WOM_PROD_SERVER_USER: user
_WOM_PROD_SERVER_HOST: localhost
_WOM_PROD_SERVER_WEBSITE_PWD: /path/to/wom-web
_GOOGLE_MAPS_API: .
_SENTRY_DSN: .
tags:
- wom-web
options:
logging: CLOUD_LOGGING_ONLY