-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
76 lines (69 loc) · 2.76 KB
/
cloudbuild.yaml
File metadata and controls
76 lines (69 loc) · 2.76 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# SPDX-License-Identifier: Apache-2.0
# Copyright 2026 Firelock, LLC
#
# Cloud Build config for kin repo.
#
# Tagging strategy:
# Every push: {image}:{COMMIT_SHA} + {image}:{sanitized-branch} (candidate)
# Push to main: {image}:staging-latest (promotion candidate)
# Prod promotion: {image}:latest (applied by promote.sh, not here)
#
# Note: npm publication for @kin/boundary-contracts is handled by the tagged
# GitHub release workflow so package publication follows the release path rather
# than the push-to-main dev build path.
steps:
# Build kin-daemon (Rust binary — CPU-intensive)
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-ceu'
- |
branch_tag="$(echo "${BRANCH_NAME:-detached}" | tr '[:upper:]' '[:lower:]' | sed 's#[^a-z0-9._-]#-#g' | sed 's#-\{2,\}#-#g' | sed 's#^-##; s#-$##' | cut -c1-120)"
branch_tag="${branch_tag:-detached}"
docker build \
-t "${_AR_REGISTRY}/kin-daemon:${COMMIT_SHA}" \
-t "${_AR_REGISTRY}/kin-daemon:${branch_tag}" \
-f Dockerfile \
.
id: 'build-kin-daemon'
# Build kin-graph-service (Node.js) — runs in parallel with kin-daemon
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-ceu'
- |
branch_tag="$(echo "${BRANCH_NAME:-detached}" | tr '[:upper:]' '[:lower:]' | sed 's#[^a-z0-9._-]#-#g' | sed 's#-\{2,\}#-#g' | sed 's#^-##; s#-$##' | cut -c1-120)"
branch_tag="${branch_tag:-detached}"
docker build \
-t "${_AR_REGISTRY}/kin-graph-service:${COMMIT_SHA}" \
-t "${_AR_REGISTRY}/kin-graph-service:${branch_tag}" \
-f Dockerfile.graph-service \
.
id: 'build-kin-graph-service'
waitFor: ['-']
# Tag as staging-latest when pushing to main
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
if [ "$BRANCH_NAME" = "main" ]; then
docker tag ${_AR_REGISTRY}/kin-daemon:${COMMIT_SHA} ${_AR_REGISTRY}/kin-daemon:staging-latest
docker tag ${_AR_REGISTRY}/kin-graph-service:${COMMIT_SHA} ${_AR_REGISTRY}/kin-graph-service:staging-latest
docker push ${_AR_REGISTRY}/kin-daemon:staging-latest
docker push ${_AR_REGISTRY}/kin-graph-service:staging-latest
echo "Tagged as staging-latest"
else
echo "Not main branch ($BRANCH_NAME), skipping staging tag"
fi
id: 'tag-staging'
waitFor: ['build-kin-daemon', 'build-kin-graph-service']
images:
- '${_AR_REGISTRY}/kin-daemon:${COMMIT_SHA}'
- '${_AR_REGISTRY}/kin-graph-service:${COMMIT_SHA}'
substitutions:
_AR_REGISTRY: 'us-central1-docker.pkg.dev/kin-ecosystem/kin-ecosystem'
options:
machineType: 'E2_HIGHCPU_8'
logging: CLOUD_LOGGING_ONLY
timeout: '1800s'