Skip to content

Eliminate all the remaining static mappings by wiring in all backend … #1572

Eliminate all the remaining static mappings by wiring in all backend …

Eliminate all the remaining static mappings by wiring in all backend … #1572

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 }}