-
Notifications
You must be signed in to change notification settings - Fork 51
391 lines (360 loc) · 15.5 KB
/
Copy pathdocker-build-push.yaml
File metadata and controls
391 lines (360 loc) · 15.5 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
name: Build and Push Project Docker Images
on:
push:
tags: ["*"]
branches:
- main
pull_request:
paths:
- "coffeeAGNTCY/coffee_agents/**"
- "docker/**"
- "!coffeeAGNTCY/coffee_agents/*/deployment/helm/**"
- "!coffeeAGNTCY/coffee_agents/*/tests/**"
- "!coffeeAGNTCY/coffee_agents/*/docs/**"
- ".github/workflows/docker-build-push.yaml"
- ".github/workflows/docker-build-reusable.yaml"
- ".github/actions/check-paths-have-changes/**"
- ".dockerignore"
workflow_dispatch:
inputs:
push:
description: "Whether to push the container images to the registry."
required: false
type: boolean
default: false
build_corto:
description: "Whether to build the corto container images."
required: false
type: boolean
default: true
build_lungo:
description: "Whether to build the lungo container images."
required: false
type: boolean
default: true
build_recruiter:
description: "Whether to build the recruiter container images."
required: false
type: boolean
default: true
image_tag:
description: "The tag to use for the container images."
required: false
type: string
default: ""
env:
CORTO_DIR: coffeeAGNTCY/coffee_agents/corto
LUNGO_DIR: coffeeAGNTCY/coffee_agents/lungo
RECRUITER_DIR: coffeeAGNTCY/coffee_agents/recruiter
jobs:
subprojects-to-build:
runs-on: ubuntu-latest
outputs:
build_corto: ${{ steps.choose-subprojects.outputs.build_corto }}
build_lungo: ${{ steps.choose-subprojects.outputs.build_lungo }}
build_recruiter: ${{ steps.choose-subprojects.outputs.build_recruiter }}
defaults:
run:
shell: bash
env:
WORKFLOW_FILES_LIST_JSON: '[".github/workflows/docker-build-push.yaml", ".github/workflows/docker-build-reusable.yaml", ".github/actions/check-paths-have-changes"]'
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Log event info
run: |
echo "event_name=${{ github.event_name }}"
echo "ref=${{ github.ref }}"
echo "ref_name=${{ github.ref_name }}"
- name: Log relevant dispatch inputs
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "build_corto=${{ inputs.build_corto }}"
echo "build_lungo=${{ inputs.build_lungo }}"
echo "build_recruiter=${{ inputs.build_recruiter }}"
- name: Prepare subproject paths JSON lists
if: ${{ github.event_name == 'pull_request' }}
id: prepare-path-lists
run: |
paths_json_corto=$(echo $WORKFLOW_FILES_LIST_JSON | jq -c -r --arg new_val "$CORTO_DIR" '[$new_val] + .')
echo "paths_json_corto=$paths_json_corto" | tee -a $GITHUB_OUTPUT
paths_json_lungo=$(echo $WORKFLOW_FILES_LIST_JSON | jq -c -r --arg new_val "$LUNGO_DIR" '[$new_val] + .')
echo "paths_json_lungo=$paths_json_lungo" | tee -a $GITHUB_OUTPUT
paths_json_recruiter=$(echo $WORKFLOW_FILES_LIST_JSON | jq -c -r --arg new_val "$RECRUITER_DIR" '[$new_val] + .')
echo "paths_json_recruiter=$paths_json_recruiter" | tee -a $GITHUB_OUTPUT
- name: Check paths have changes for Corto
if: ${{ github.event_name == 'pull_request' }}
id: check-paths-corto
uses: ./.github/actions/check-paths-have-changes
with:
base_sha: ${{ github.event.pull_request.base.sha }}
head_sha: ${{ github.event.pull_request.head.sha }}
paths_json_list: ${{ steps.prepare-path-lists.outputs.paths_json_corto }}
- name: Check paths have changes for Lungo
if: ${{ github.event_name == 'pull_request' }}
id: check-paths-lungo
uses: ./.github/actions/check-paths-have-changes
with:
base_sha: ${{ github.event.pull_request.base.sha }}
head_sha: ${{ github.event.pull_request.head.sha }}
paths_json_list: ${{ steps.prepare-path-lists.outputs.paths_json_lungo }}
- name: Check paths have changes for Recruiter
if: ${{ github.event_name == 'pull_request' }}
id: check-paths-recruiter
uses: ./.github/actions/check-paths-have-changes
with:
base_sha: ${{ github.event.pull_request.base.sha }}
head_sha: ${{ github.event.pull_request.head.sha }}
paths_json_list: ${{ steps.prepare-path-lists.outputs.paths_json_recruiter }}
- name: Determine build choices for subprojects
id: choose-subprojects
run: |
build_corto=false
build_lungo=false
build_recruiter=false
if [[ "${{ github.event_name }}" == "push" ]]; then
build_corto=true
build_lungo=true
build_recruiter=true
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
build_corto=${{ inputs.build_corto }}
build_lungo=${{ inputs.build_lungo }}
build_recruiter=${{ inputs.build_recruiter }}
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
build_corto=${{ steps.check-paths-corto.outputs.changed }}
build_lungo=${{ steps.check-paths-lungo.outputs.changed }}
build_recruiter=${{ steps.check-paths-recruiter.outputs.changed }}
fi
echo "build_corto=$build_corto" | tee -a $GITHUB_OUTPUT
echo "build_lungo=$build_lungo" | tee -a $GITHUB_OUTPUT
echo "build_recruiter=$build_recruiter" | tee -a $GITHUB_OUTPUT
compute-build-parameters:
runs-on: ubuntu-latest
outputs:
push: ${{ steps.build_params.outputs.push}}
image_tag: ${{ steps.build_params.outputs.image_tag }}
git_branch: ${{ steps.build_params.outputs.git_branch }}
defaults:
run:
shell: bash
steps:
- name: Log event info
run: |
echo "event_name=${{ github.event_name }}"
echo "ref=${{ github.ref }}"
echo "ref_name=${{ github.ref_name }}"
- name: Log relevant dispatch inputs
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "push=${{ inputs.push }}"
echo "image_tag=${{ inputs.image_tag }}"
- name: Compute build parameters
id: build_params
run: |
# default values
push=false
image_tag=unknown
git_branch=${{ github.ref_name }}
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
image_tag=pr-${{ github.event.pull_request.number }}
git_branch=${{ github.head_ref }}
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
push=true
image_tag=latest
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/* ]]; then
push=true
image_tag=${{ github.ref_name }}
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
push=${{ inputs.push }}
if [[ "${{ inputs.image_tag }}" != "" ]]; then
image_tag=${{ inputs.image_tag }}
else
short_sha=${GITHUB_SHA:0:7}
image_tag="dispatch_${short_sha}_run-${{ github.run_number }}" # informative default tag (though not unique)
fi
fi
echo "push=$push" | tee -a $GITHUB_OUTPUT
echo "image_tag=$image_tag" | tee -a $GITHUB_OUTPUT
echo "git_branch=$git_branch" | tee -a $GITHUB_OUTPUT
docker-build-corto:
needs: [subprojects-to-build, compute-build-parameters]
if: ${{ needs.subprojects-to-build.outputs.build_corto == 'true' }}
strategy:
matrix:
image:
- name: corto-ui
dockerfile: docker/Dockerfile.ui
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/corto/exchange/frontend
NPM_CACHE_ID=corto
- name: corto-exchange
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/corto
UV_CACHE_ID=corto
APP_NAME=corto-exchange
AGENT_SCRIPT=exchange/main.py
- name: corto-farm
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/corto
UV_CACHE_ID=corto
APP_NAME=corto-farm
AGENT_SCRIPT=farm/farm_server.py
permissions: # permissions can only be maintained or reduced (not elevated) throughout a chain of workflows
packages: write
contents: read
uses: ./.github/workflows/docker-build-reusable.yaml
with:
name: ${{ matrix.image.name }}
dockerfile: ${{ matrix.image.dockerfile }}
target: ${{ matrix.image.target }}
extra_build_args: ${{ matrix.image.extra_build_args }}
push: ${{ needs.compute-build-parameters.outputs.push == 'true' }}
platforms: linux/amd64,linux/arm64
image_tag: ${{ needs.compute-build-parameters.outputs.image_tag }}
git_branch: ${{ needs.compute-build-parameters.outputs.git_branch }}
docker-build-lungo:
needs: [subprojects-to-build, compute-build-parameters]
if: ${{ needs.subprojects-to-build.outputs.build_lungo == 'true' }}
strategy:
matrix:
image:
- name: lungo-ui
dockerfile: docker/Dockerfile.ui
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo/frontend
NPM_CACHE_ID=lungo
- name: auction-supervisor
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=lungo-auction-supervisor
AGENT_SCRIPT=agents/supervisors/auction/main.py
- name: agentic-workflows-api
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=agentic-workflows-api
AGENT_SCRIPT=-m api.agentic_workflows.server
- name: brazil-farm
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=brazil-farm
AGENT_SCRIPT=agents/farms/brazil/farm_server.py
- name: colombia-farm
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=colombia-farm
AGENT_SCRIPT=agents/farms/colombia/farm_server.py
- name: vietnam-farm
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=vietnam-farm
AGENT_SCRIPT=agents/farms/vietnam/farm_server.py
- name: weather-mcp-server
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=weather-mcp-server
AGENT_SCRIPT=agents/mcp_servers/weather_service.py
- name: payment-mcp-server
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=payment-mcp-server
AGENT_SCRIPT=agents/mcp_servers/payment_service.py
- name: logistics-shipper
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=logistics-shipper
AGENT_SCRIPT=agents/logistics/shipper/server.py
- name: logistics-accountant
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=logistics-accountant
AGENT_SCRIPT=agents/logistics/accountant/server.py
- name: logistics-farm
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=logistics-farm
AGENT_SCRIPT=agents/logistics/farm/server.py
- name: logistics-supervisor
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=logistics-supervisor
AGENT_SCRIPT=agents/supervisors/logistics/main.py
- name: logistics-helpdesk
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=logistics-helpdesk
AGENT_SCRIPT=agents/logistics/helpdesk/server.py
- name: recruiter-supervisor
dockerfile: docker/Dockerfile.python-agent
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/lungo
UV_CACHE_ID=lungo
APP_NAME=lungo-recruiter-supervisor
AGENT_SCRIPT=agents/supervisors/recruiter/main.py
permissions: # permissions can only be maintained or reduced (not elevated) throughout a chain of workflows
packages: write
contents: read
uses: ./.github/workflows/docker-build-reusable.yaml
with:
name: ${{ matrix.image.name }}
dockerfile: ${{ matrix.image.dockerfile }}
target: ${{ matrix.image.target }}
extra_build_args: ${{ matrix.image.extra_build_args }}
push: ${{ needs.compute-build-parameters.outputs.push == 'true' }}
platforms: linux/amd64,linux/arm64
image_tag: ${{ needs.compute-build-parameters.outputs.image_tag }}
git_branch: ${{ needs.compute-build-parameters.outputs.git_branch }}
docker-build-recruiter:
needs: [subprojects-to-build, compute-build-parameters]
if: ${{ needs.subprojects-to-build.outputs.build_recruiter == 'true' }}
strategy:
matrix:
image:
- name: recruiter
dockerfile: docker/Dockerfile.python-agent
target: agent-with-dirctl
extra_build_args: |
PROJECT_PATH=coffeeAGNTCY/coffee_agents/recruiter
UV_CACHE_ID=recruiter
AGENT_SCRIPT=src/agent_recruiter/server/server.py
APP_NAME=recruiter
permissions: # permissions can only be maintained or reduced (not elevated) throughout a chain of workflows
packages: write
contents: read
uses: ./.github/workflows/docker-build-reusable.yaml
with:
name: ${{ matrix.image.name }}
dockerfile: ${{ matrix.image.dockerfile }}
target: ${{ matrix.image.target }}
extra_build_args: ${{ matrix.image.extra_build_args }}
push: ${{ needs.compute-build-parameters.outputs.push == 'true' }}
platforms: linux/amd64,linux/arm64
image_tag: ${{ needs.compute-build-parameters.outputs.image_tag }}
git_branch: ${{ needs.compute-build-parameters.outputs.git_branch }}