-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcloudbuild_cd.yaml
More file actions
43 lines (40 loc) · 1.67 KB
/
cloudbuild_cd.yaml
File metadata and controls
43 lines (40 loc) · 1.67 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
# CD 파이프라인: 검증된 이미지를 Cloud Run에 배포
options:
logging: CLOUD_LOGGING_ONLY
substitutions:
_SERVICE_NAME: 'my-fastapi-service'
_REGION: 'asia-northeast3'
steps:
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
id: Wait for image to exist
entrypoint: bash
args:
- -c
- |
for i in {1..10}; do
if gcloud artifacts docker images list $_REGION-docker.pkg.dev/$PROJECT_ID/tripout-repo | grep $SHORT_SHA; then
echo "✅ Image $_REGION-docker.pkg.dev/$PROJECT_ID/tripout-repo/${_SERVICE_NAME}:$SHORT_SHA is ready"
break
else
echo "⏳ Waiting for image $_REGION-docker.pkg.dev/$PROJECT_ID/tripout-repo/${_SERVICE_NAME}:$SHORT_SHA ..."
sleep 6
fi
done
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
id: Deploy to Cloud Run
entrypoint: gcloud
args:
- run
- deploy
- ${_SERVICE_NAME}
- --image
- $_REGION-docker.pkg.dev/$PROJECT_ID/tripout-repo/${_SERVICE_NAME}:$SHORT_SHA
- --region
- $_REGION
- --platform
- managed
- --service-account=tripout-runner@${PROJECT_ID}.iam.gserviceaccount.com
- --add-cloudsql-instances=tripout-project:asia-northeast3:tripout-instance
- --update-secrets=KAKAO_REST_API_KEY=KAKAO_REST_API_KEY:latest,OPENAI_API_KEY=OPENAI_API_KEY:latest,GEMINI_API_KEY=GEMINI_API_KEY:latest,NAVER_API_CLIENT_ID=NAVER_API_CLIENT_ID:latest,NAVER_API_CLIENT_SECRET=NAVER_API_CLIENT_SECRET:latest,DB_PASSWORD=DB_PASSWORD:latest,DB_HOST=DB_HOST:latest,DB_USER=DB_USER:latest,DB_NAME=DB_NAME:latest
- --set-env-vars=DB_PORT=3306
- --allow-unauthenticated