forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgcp_backend_agent_proxy_auto_deploy.yml
More file actions
77 lines (63 loc) · 2.72 KB
/
Copy pathgcp_backend_agent_proxy_auto_deploy.yml
File metadata and controls
77 lines (63 loc) · 2.72 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
name: Auto Deploy Agent Proxy to GKE (Development)
on:
push:
branches: [ "main" ]
paths:
- 'backend/agent-proxy/**'
- 'backend/charts/agent-proxy/**'
- 'backend/utils/__init__.py'
- 'backend/utils/executors.py'
# Share the development agent-proxy lock with manual deployments.
concurrency:
group: deploy-gke-agent-proxy-development
cancel-in-progress: false
env:
SERVICE: agent-proxy
REGION: us-central1
jobs:
deploy:
environment: development
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
# To workaround "no space left on device" issue of GitHub-hosted runner
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Checkout
uses: actions/checkout@v7
- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v3'
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v3
- name: Login to GCR
run: gcloud auth configure-docker
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and Push Docker image
run: |
docker build -t gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}:${GITHUB_SHA::7} -f backend/agent-proxy/Dockerfile .
python3 backend/scripts/runtime_image_contracts.py smoke \
--dockerfile backend/agent-proxy/Dockerfile \
--image gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}:${GITHUB_SHA::7}
docker push gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}:${GITHUB_SHA::7}
- name: Get GKE credentials
uses: google-github-actions/get-gke-credentials@v3
with:
cluster_name: ${{ vars.GKE_CLUSTER }}
location: ${{ env.REGION }}
project_id: ${{ vars.GCP_PROJECT_ID }}
- name: Deploy Agent Proxy to GKE cluster using Helm
run: |
helm -n ${{ vars.ENV }}-omi-backend upgrade --install ${{ vars.ENV }}-omi-agent-proxy ./backend/charts/agent-proxy -f ./backend/charts/agent-proxy/${{ vars.ENV }}_omi_agent_proxy_values.yaml --set-string "image.tag=${GITHUB_SHA::7}"
if ! kubectl -n ${{ vars.ENV }}-omi-backend rollout status deploy/${{ vars.ENV }}-omi-agent-proxy --timeout=300s; then
python3 backend/scripts/deploy_status_report.py --env ${{ vars.ENV }} --include-gke --gke-service agent-proxy || true
exit 1
fi
python3 backend/scripts/deploy_status_report.py --env ${{ vars.ENV }} --include-gke --gke-service agent-proxy
- name: Show Output
run: echo "Agent proxy deployed to development environment"