8
8
# https://docs.docker.com/engine/reference/commandline/build/
9
9
# https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/docker
10
10
# https://cloud.google.com/build/docs/kaniko-cache
11
- - id : Build
11
+ - id : build
12
12
name : gcr.io/kaniko-project/executor
13
13
args :
14
14
- --dockerfile=./Dockerfile
15
- - --destination=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME :$COMMIT_SHA
15
+ - --destination=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/lit-dev :$COMMIT_SHA
16
16
- --cache=true
17
17
- --cache-ttl=168h # 1 week
18
+ # Bake in the playground sandbox url
19
+ - --build-arg=PLAYGROUND_SANDBOX=https://lit-dev-playground-5ftespv5na-uc.a.run.app/
18
20
19
- # Create a new Cloud Run revision.
21
+ # Create a new Cloud Run revision for the main site .
20
22
#
21
23
# https://cloud.google.com/sdk/gcloud/reference/beta/run/deploy
22
24
# https://github.com/GoogleCloudPlatform/cloud-sdk-docker
23
- - id : Deploy
25
+ - id : deploy-main
24
26
name : gcr.io/google.com/cloudsdktool/cloud-sdk
25
27
entrypoint : gcloud
26
28
args :
27
29
- beta
28
30
- run
29
31
- deploy
30
- - $_SERVICE_NAME
32
+ - lit-dev # Service name
31
33
- ' --region=$_DEPLOY_REGION'
32
34
- ' --platform=managed'
33
- - ' --image=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME :$COMMIT_SHA'
35
+ - ' --image=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/lit-dev :$COMMIT_SHA'
34
36
- ' --quiet'
35
37
- ' --no-traffic'
36
38
- ' --tag=master-$SHORT_SHA'
@@ -42,20 +44,80 @@ steps:
42
44
- ' --concurrency=40'
43
45
- ' --min-instances=1'
44
46
- ' --max-instances=1000'
47
+ # Serve the main site
48
+ - ' --update-env-vars=MODE=main'
45
49
46
- # Route traffic to new revision.
50
+ # Create a new Cloud Run revision for the Playground sandbox.
51
+ #
52
+ # https://cloud.google.com/sdk/gcloud/reference/beta/run/deploy
53
+ # https://github.com/GoogleCloudPlatform/cloud-sdk-docker
54
+ - id : deploy-playground
55
+ name : gcr.io/google.com/cloudsdktool/cloud-sdk
56
+ entrypoint : gcloud
57
+ waitFor :
58
+ # Don't wait for main site deploy
59
+ - build
60
+ args :
61
+ - beta
62
+ - run
63
+ - deploy
64
+ - lit-dev-playground # Service name
65
+ - ' --region=$_DEPLOY_REGION'
66
+ - ' --platform=managed'
67
+ - ' --image=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/lit-dev:$COMMIT_SHA'
68
+ - ' --quiet'
69
+ - ' --no-traffic'
70
+ - ' --tag=master-$SHORT_SHA'
71
+ # IMPORTANT: If you change --memory, be sure to also change
72
+ # --max-old-space-size in ./Dockerfile, and this same flag in
73
+ # ./cloudbuild-pr.yaml
74
+ - ' --memory=1Gi'
75
+ - ' --cpu=1'
76
+ - ' --concurrency=40'
77
+ - ' --min-instances=1'
78
+ - ' --max-instances=1000'
79
+ # Serve the playground files
80
+ - ' --update-env-vars=MODE=playground'
81
+
82
+ # Route traffic to new revision for the playground.
47
83
#
48
84
# https://cloud.google.com/sdk/gcloud/reference/beta/run/services
49
85
# https://github.com/GoogleCloudPlatform/cloud-sdk-docker
50
- - id : Route Traffic
86
+ - id : route-traffic-main
51
87
name : gcr.io/google.com/cloudsdktool/cloud-sdk
52
88
entrypoint : gcloud
89
+ waitFor :
90
+ # Route traffic simultaneously once both deploys are done
91
+ - deploy-main
92
+ - deploy-playground
53
93
args :
54
94
- beta
55
95
- run
56
96
- services
57
97
- update-traffic
58
- - $_SERVICE_NAME
98
+ - lit-dev # Service name
99
+ - ' --region=$_DEPLOY_REGION'
100
+ - ' --platform=managed'
101
+ - ' --quiet'
102
+ - ' --to-tags=master-$SHORT_SHA=100'
103
+
104
+ # Route traffic to new revision for the main site.
105
+ #
106
+ # https://cloud.google.com/sdk/gcloud/reference/beta/run/services
107
+ # https://github.com/GoogleCloudPlatform/cloud-sdk-docker
108
+ - id : route-traffic-playground
109
+ name : gcr.io/google.com/cloudsdktool/cloud-sdk
110
+ entrypoint : gcloud
111
+ waitFor :
112
+ # Route traffic simultaneously once both deploys are done
113
+ - deploy-main
114
+ - deploy-playground
115
+ args :
116
+ - beta
117
+ - run
118
+ - services
119
+ - update-traffic # Service name
120
+ - lit-dev-playground
59
121
- ' --region=$_DEPLOY_REGION'
60
122
- ' --platform=managed'
61
123
- ' --quiet'
0 commit comments