-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
53 lines (50 loc) · 1.88 KB
/
Copy pathcloudbuild.yaml
File metadata and controls
53 lines (50 loc) · 1.88 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
steps:
- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args:
- "-c"
- |
docker buildx create --name mybuilder --use
docker buildx build \
--platform linux/amd64 \
-t us-central1-docker.pkg.dev/agentsea-dev/threadmem/api:$SHORT_SHA . \
--push \
--cache-from=type=registry,ref=us-central1-docker.pkg.dev/agentsea-dev/threadmem/api:cache \
--cache-to=type=registry,ref=us-central1-docker.pkg.dev/agentsea-dev/threadmem/api:cache,mode=max
if [ "$BRANCH_NAME" == "main" ]; then
docker buildx build \
--platform linux/amd64 \
-t us-central1-docker.pkg.dev/agentsea-dev/threadmem/api:latest . \
--push \
--cache-from=type=registry,ref=us-central1-docker.pkg.dev/agentsea-dev/threadmem/api:cache \
--cache-to=type=registry,ref=us-central1-docker.pkg.dev/agentsea-dev/threadmem/api:cache,mode=max
fi
- name: "gcr.io/cloud-builders/gcloud"
entrypoint: "bash"
args:
- "-c"
- "chmod 777 deploy/kustomize/overlays/$BRANCH_NAME/deployment_api.yaml && ls -l deploy"
# Update image in deployment.yaml using yq
- name: "mikefarah/yq"
args:
- "eval"
- "-i"
- '.spec.template.spec.containers[0].image = "us-central1-docker.pkg.dev/agentsea-dev/threadmem/api:$SHORT_SHA"'
- "deploy/kustomize/overlays/$BRANCH_NAME/deployment_api.yaml"
# Apply to the cluster
- id: "Apply kustomize overlay"
name: "gcr.io/cloud-builders/kubectl"
args:
- "apply"
- "-k"
- "deploy/kustomize/overlays/$BRANCH_NAME"
- "-n"
- "threadmem-$BRANCH_NAME"
env:
- "CLOUDSDK_COMPUTE_REGION=us-central1"
- "CLOUDSDK_CONTAINER_CLUSTER=hub-gke-cluster-3f94b5f"
- "CLOUDSDK_CONFIG_PROJECT=$PROJECT_ID"
options:
volumes:
- name: "pip-cache"
path: "/root/.cache/pip"