OSVauco/cloudbuild.yaml

72 lines
1.8 KiB
YAML

# cloudbuild.yaml — Cloud Build CI/CD pipeline for OSVauco ADK agent
# Triggered on push to main branch
# Stages: install + test → eval gate → build image → push → deploy to Cloud Run
substitutions:
_PROJECT_ID: propane-will-491900-m5
_REGION: us-central1
_SERVICE_NAME: oavauco-agent-v1
_AR_REPO: oavauco-docker
_IMAGE: ${_REGION}-docker.pkg.dev/${_PROJECT_ID}/${_AR_REPO}/oavauco-agent:${SHORT_SHA}
steps:
- name: 'python:3.12-slim'
id: 'install-and-test'
entrypoint: bash
args:
- '-c'
- |
pip install -r agents/core-logic/requirements.txt --quiet
if [ -d "agents/tests/unit" ]; then
python -m pytest agents/tests/unit/ -v
fi
echo "Install + tests complete."
- name: 'python:3.12-slim'
id: 'eval-gate'
entrypoint: bash
env:
- 'GOOGLE_CLOUD_PROJECT=${_PROJECT_ID}'
- 'GOOGLE_CLOUD_LOCATION=${_REGION}'
- 'GOOGLE_GENAI_USE_VERTEXAI=True'
args:
- '-c'
- |
pip install google-cloud-aiplatform[evaluation] --quiet
python agents/eval/run_eval.py
- name: 'gcr.io/cloud-builders/docker'
id: 'build-image'
args:
- 'build'
- '-t'
- '${_IMAGE}'
- '-f'
- 'agents/core-logic/Dockerfile'
- 'agents/core-logic'
- name: 'gcr.io/cloud-builders/docker'
id: 'push-image'
args: ['push', '${_IMAGE}']
- name: 'gcr.io/cloud-builders/gcloud'
id: 'deploy-cloud-run'
args:
- 'run'
- 'deploy'
- '${_SERVICE_NAME}'
- '--image=${_IMAGE}'
- '--region=${_REGION}'
- '--project=${_PROJECT_ID}'
- '--service-account=vertex-agent-sa@${_PROJECT_ID}.iam.gserviceaccount.com'
- '--no-allow-unauthenticated'
- '--min-instances=0'
- '--platform=managed'
- '--quiet'
images:
- '${_IMAGE}'
options:
logging: CLOUD_LOGGING_ONLY