-
Notifications
You must be signed in to change notification settings - Fork 3
/
cloudbuild.yaml
68 lines (63 loc) · 1.92 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
steps:
- name: gcr.io/cloud-builders/git
args: ['fetch', '--unshallow', '--no-tags']
- name: 'gcr.io/$PROJECT_ID/restore_cache'
id: restore_cache
waitFor: ['-']
script: |
#!/usr/bin/env bash
restore_cache \
--bucket=gs://frontend-cache-dependencies \
--key=node_modules-$( checksum yarn.lock )
restore_cache \
--bucket=gs://frontend-cache-dependencies \
--key=yarn-$( checksum yarn.lock )
restore_cache \
--bucket=gs://frontend-cache-dependencies \
--key=yarn-install-state-$( checksum yarn.lock )
- id: 'install-yarn'
waitFor: ['restore_cache']
name: node:21
script: |
yarn set version 4.6.0
yarn -v
yarn install --immutable
- id: 'save_cache'
waitFor: ['install-yarn']
name: 'gcr.io/$PROJECT_ID/restore_cache'
script: |
#!/usr/bin/env bash
save_cache \
--bucket=gs://frontend-cache-dependencies \
--key=node_modules-$( checksum yarn.lock ) \
--path=./node_modules \
--no-clobber
save_cache \
--bucket=gs://frontend-cache-dependencies \
--key=yarn-$( checksum yarn.lock ) \
--path=.yarn/cache \
--no-clobber
save_cache \
--bucket=gs://frontend-cache-dependencies \
--key=yarn-install-state-$( checksum yarn.lock ) \
--path=.yarn/install-state.gz \
--no-clobber
- id: get-affected
name: 'node:21'
entrypoint: yarn
args: ['affected']
# Trigger the affected apps builds
- name: gcr.io/cloud-builders/gcloud
waitFor: ['get-affected']
id: deploy-cloud-run
entrypoint: bash
args:
- '-eEuo'
- 'pipefail'
- '-c'
- |-
AFFECTED_APPS=(`cat affected-apps.txt`)
echo `cat affected-apps.txt`
for i in ${AFFECTED_APPS[@]//,/}; do
[ ! -z "$i" ] && gcloud -q beta builds triggers run --branch=develop ui-${i}-develop
done