Skip to content

Commit 458ce8b

Browse files
console-log-kaihasura-bot
authored andcommitted
Build configs for preview builds through GKE
Build configs for preview builds through GKE ## Description ✍️ Moving the docs preview builds from Cloudflare to "websitecloud" Google Cloud Project which is currently handling the staging and production deployments: The preview triggers are expected to be called only on changes to the docs folder PR-URL: hasura/graphql-engine-mono#6999 GitOrigin-RevId: 1699fe7677ebc03b8ce6338394e91d8e848640c3
1 parent 43779ff commit 458ce8b

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

docs/.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
.git
3+
.gitignore
4+
node_modules
5+
yarn-error.log
6+
.docusaurus

docs/Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Used only for preview builds
2+
3+
FROM --platform=linux/amd64 node:17-alpine
4+
5+
ENV release_mode="staging"
6+
7+
ENV BUILD_VERSION="2.0"
8+
9+
RUN apk add --update git \
10+
bash \
11+
yarn
12+
13+
#WORKDIR /app
14+
WORKDIR /graphql-engine/docs
15+
16+
# Bundle app source
17+
COPY . .
18+
19+
RUN yarn
20+
21+
RUN yarn build
22+
23+
CMD ["yarn", "run", "serve", "-p", "8080", "--host", "0.0.0.0"]

docs/preview_cloud_build.yaml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
steps:
2+
3+
#kaniko
4+
- name: 'gcr.io/kaniko-project/executor:latest'
5+
id: kaniko
6+
args:
7+
[
8+
"--dockerfile=./Dockerfile",
9+
"--context=dir:///workspace/docs",
10+
"--cache=false",
11+
"--cache-ttl=1h",
12+
"--destination=us-west1-docker.pkg.dev/${PROJECT_ID}/docusaurus/docusaurus:${_PR_NUMBER}-${SHORT_SHA}",
13+
]
14+
15+
- id: "deploy revision with tag"
16+
name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
17+
entrypoint: "gcloud"
18+
args:
19+
[
20+
"run",
21+
"deploy",
22+
"${_SERVICE_NAME}",
23+
"--platform",
24+
"managed",
25+
"--region",
26+
"${_REGION}",
27+
"--image",
28+
"us-west1-docker.pkg.dev/${PROJECT_ID}/docusaurus/docusaurus:${_PR_NUMBER}-${SHORT_SHA}",
29+
"--tag",
30+
"pr-${_PR_NUMBER}",
31+
"--no-traffic",
32+
]
33+
34+
- id: "link revision on pull request"
35+
name: "gcr.io/${PROJECT_ID}/deployment-previews" # our custom builder
36+
secretEnv: ["GITHUB_TOKEN"]
37+
args:
38+
[
39+
"set",
40+
"--project-id",
41+
"${PROJECT_ID}",
42+
"--region",
43+
"${_REGION}",
44+
"--service",
45+
"${_SERVICE_NAME}",
46+
"--pull-request",
47+
"${_PR_NUMBER}",
48+
"--repo-name",
49+
"${_GITHUB_REPO}",
50+
"--commit-sha",
51+
"${SHORT_SHA}",
52+
]
53+
54+
timeout: 3600s
55+
56+
substitutions:
57+
_SERVICE_NAME: docusaurus
58+
_REGION: us-west2
59+
_GITHUB_REPO: $(pull_request.pull_request.head.repo.full_name)
60+
61+
options:
62+
dynamicSubstitutions: true
63+
workerPool: 'projects/websitecloud-352908/locations/us-west2/workerPools/gke-vpn-pool'
64+
65+
availableSecrets:
66+
secretManager:
67+
- versionName: projects/$PROJECT_ID/secrets/github_token/versions/latest
68+
env: "GITHUB_TOKEN"

0 commit comments

Comments
 (0)