-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
165 lines (143 loc) · 6.4 KB
/
cloudbuild.yaml
File metadata and controls
165 lines (143 loc) · 6.4 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
---
steps:
# 1. Versioning Helper (Calculate major.minor)
- name: 'gcr.io/cloud-builders/gcloud'
id: 'calculate-tags'
entrypoint: 'bash'
args:
- '-c'
- |
echo "$_VERSION" | cut -d. -f1,2 > .short_version
echo "Short version: $(cat .short_version)"
# 2. Build Images in Parallel
- name: 'gcr.io/cloud-builders/docker'
id: 'build-api'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_APP_NAME:$_VERSION', '.']
dir: 'api-server'
waitFor: ['-']
- name: 'gcr.io/cloud-builders/docker'
id: 'build-ui'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_APP_NAME/ui:$_VERSION', '.']
dir: 'ui'
waitFor: ['-']
- name: 'gcr.io/cloud-builders/docker'
id: 'build-sql'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_APP_NAME/sql:$_VERSION', '.']
dir: 'query-engine'
waitFor: ['-']
- name: 'gcr.io/cloud-builders/docker'
id: 'build-proxy'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_APP_NAME/proxy:$_VERSION', '.']
dir: 'proxy-config'
waitFor: ['-']
- name: 'gcr.io/cloud-builders/docker'
id: 'build-util'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_APP_NAME/util:$_VERSION', '.']
dir: 'google-marketplace/util-image'
waitFor: ['-']
- name: 'gcr.io/cloud-builders/docker'
id: 'build-tester'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_APP_NAME/tester:$_VERSION', '.']
dir: 'google-marketplace/apptest/tester'
waitFor: ['-']
- name: 'gcr.io/cloud-builders/docker'
id: 'build-ai-agent'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_APP_NAME/ai-agent:$_VERSION', '.']
dir: 'ai-agent'
waitFor: ['-']
# 3. Handle UBBAgent & Pull/Tag
- name: 'gcr.io/cloud-builders/docker'
id: 'tag-ubbagent'
entrypoint: 'bash'
args:
- '-c'
- |
docker pull gcr.io/cloud-marketplace-tools/metering/ubbagent:latest
docker tag gcr.io/cloud-marketplace-tools/metering/ubbagent:latest gcr.io/$PROJECT_ID/$_APP_NAME/ubbagent:$_VERSION
waitFor: ['-']
# 4. Deployer (Depends on other builds being ready to pull for chart bundling)
- name: 'gcr.io/cloud-builders/docker'
id: 'build-deployer'
args: ['build',
'--build-arg', 'REGISTRY=gcr.io/$PROJECT_ID',
'--build-arg', 'TAG=$_VERSION',
'-t', 'gcr.io/$PROJECT_ID/$_APP_NAME/deployer:$_VERSION',
'-f', 'deployer/Dockerfile',
'.']
dir: 'google-marketplace'
waitFor: ['-']
# 5. Push Images (Required for Crane mutations)
- name: 'gcr.io/cloud-builders/docker'
id: 'push-all'
entrypoint: 'bash'
args:
- '-c'
- |
for img in "" "/ui" "/sql" "/proxy" "/util" "/tester" "/deployer" "/ai-agent" "/ubbagent"; do
docker push gcr.io/$PROJECT_ID/$_APP_NAME$${img}:$_VERSION
done
waitFor: ['build-api', 'build-ui', 'build-sql', 'build-proxy', 'build-util', 'build-tester', 'build-deployer', 'build-ai-agent', 'tag-ubbagent']
# 6. Apply Secondary Tags (major.minor)
- name: 'gcr.io/cloud-builders/docker'
id: 'apply-short-tags'
entrypoint: 'bash'
args:
- '-c'
- |
SHORT_VER=$(cat .short_version)
for img in "" "/ui" "/sql" "/proxy" "/util" "/tester" "/deployer" "/ai-agent" "/ubbagent"; do
docker tag gcr.io/$PROJECT_ID/$_APP_NAME$${img}:$_VERSION gcr.io/$PROJECT_ID/$_APP_NAME$${img}:$${SHORT_VER}
docker push gcr.io/$PROJECT_ID/$_APP_NAME$${img}:$${SHORT_VER}
done
waitFor: ['push-all', 'calculate-tags']
# 7. Apply Marketplace Annotations using Crane
- name: 'gcr.io/go-containerregistry/crane'
id: 'annotate-base'
args: ['mutate', 'gcr.io/$PROJECT_ID/$_APP_NAME:$_VERSION', '--annotation', 'com.googleapis.cloudmarketplace.product.service.name=services/visulate-for-oracle.mp-visulate-llc-public.appspot.com']
waitFor: ['push-all']
- name: 'gcr.io/go-containerregistry/crane'
id: 'annotate-ui'
args: ['mutate', 'gcr.io/$PROJECT_ID/$_APP_NAME/ui:$_VERSION', '--annotation', 'com.googleapis.cloudmarketplace.product.service.name=services/visulate-for-oracle.mp-visulate-llc-public.appspot.com']
waitFor: ['push-all']
- name: 'gcr.io/go-containerregistry/crane'
id: 'annotate-sql'
args: ['mutate', 'gcr.io/$PROJECT_ID/$_APP_NAME/sql:$_VERSION', '--annotation', 'com.googleapis.cloudmarketplace.product.service.name=services/visulate-for-oracle.mp-visulate-llc-public.appspot.com']
waitFor: ['push-all']
- name: 'gcr.io/go-containerregistry/crane'
id: 'annotate-proxy'
args: ['mutate', 'gcr.io/$PROJECT_ID/$_APP_NAME/proxy:$_VERSION', '--annotation', 'com.googleapis.cloudmarketplace.product.service.name=services/visulate-for-oracle.mp-visulate-llc-public.appspot.com']
waitFor: ['push-all']
- name: 'gcr.io/go-containerregistry/crane'
id: 'annotate-util'
args: ['mutate', 'gcr.io/$PROJECT_ID/$_APP_NAME/util:$_VERSION', '--annotation', 'com.googleapis.cloudmarketplace.product.service.name=services/visulate-for-oracle.mp-visulate-llc-public.appspot.com']
waitFor: ['push-all']
- name: 'gcr.io/go-containerregistry/crane'
id: 'annotate-tester'
args: ['mutate', 'gcr.io/$PROJECT_ID/$_APP_NAME/tester:$_VERSION', '--annotation', 'com.googleapis.cloudmarketplace.product.service.name=services/visulate-for-oracle.mp-visulate-llc-public.appspot.com']
waitFor: ['push-all']
- name: 'gcr.io/go-containerregistry/crane'
id: 'annotate-deployer'
args: ['mutate', 'gcr.io/$PROJECT_ID/$_APP_NAME/deployer:$_VERSION', '--annotation', 'com.googleapis.cloudmarketplace.product.service.name=services/visulate-for-oracle.mp-visulate-llc-public.appspot.com']
waitFor: ['push-all']
- name: 'gcr.io/go-containerregistry/crane'
id: 'annotate-ai-agent'
args: ['mutate', 'gcr.io/$PROJECT_ID/$_APP_NAME/ai-agent:$_VERSION', '--annotation', 'com.googleapis.cloudmarketplace.product.service.name=services/visulate-for-oracle.mp-visulate-llc-public.appspot.com']
waitFor: ['push-all']
- name: 'gcr.io/go-containerregistry/crane'
id: 'annotate-ubbagent'
args: ['mutate', 'gcr.io/$PROJECT_ID/$_APP_NAME/ubbagent:$_VERSION', '--annotation', 'com.googleapis.cloudmarketplace.product.service.name=services/visulate-for-oracle.mp-visulate-llc-public.appspot.com']
waitFor: ['push-all']
images:
- 'gcr.io/$PROJECT_ID/$_APP_NAME:$_VERSION'
- 'gcr.io/$PROJECT_ID/$_APP_NAME/ui:$_VERSION'
- 'gcr.io/$PROJECT_ID/$_APP_NAME/sql:$_VERSION'
- 'gcr.io/$PROJECT_ID/$_APP_NAME/proxy:$_VERSION'
- 'gcr.io/$PROJECT_ID/$_APP_NAME/util:$_VERSION'
- 'gcr.io/$PROJECT_ID/$_APP_NAME/tester:$_VERSION'
- 'gcr.io/$PROJECT_ID/$_APP_NAME/deployer:$_VERSION'
- 'gcr.io/$PROJECT_ID/$_APP_NAME/ai-agent:$_VERSION'
- 'gcr.io/$PROJECT_ID/$_APP_NAME/ubbagent:$_VERSION'
timeout: 1800s
substitutions:
_APP_NAME: visulate-for-oracle
_VERSION: 2.5.0