From 03a35f7efc8d7f9eba9d30fffe50f79e7477cd74 Mon Sep 17 00:00:00 2001 From: yamashita-kenngo Date: Fri, 3 May 2024 20:29:53 +0900 Subject: [PATCH] chore: add build yaml --- cloudbuild_pr.yaml | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 cloudbuild_pr.yaml diff --git a/cloudbuild_pr.yaml b/cloudbuild_pr.yaml new file mode 100644 index 0000000..95c0edb --- /dev/null +++ b/cloudbuild_pr.yaml @@ -0,0 +1,51 @@ +steps: + - name: gcr.io/cloud-builders/docker + args: + - build + - '--no-cache' + - '-t' + - >- + $_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA + - . + - '-f' + - Dockerfile + id: Build + - name: gcr.io/cloud-builders/docker + args: + - push + - >- + $_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA + id: Push + - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim' + args: + - run + - services + - update + - $_SERVICE_NAME + - '--platform=managed' + - >- + --image=$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA + - >- + --labels=managed-by=gcp-cloud-build-deploy-cloud-run,commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID + - '--region=$_DEPLOY_REGION' + - >- + --tag=$BRANCH_NAME + - '--quiet' + - '--no-traffic' + id: DeployTag + entrypoint: gcloud +images: + - >- + $_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA +options: + substitutionOption: ALLOW_LOOSE +substitutions: + _PLATFORM: managed + _SERVICE_NAME: demo-backend-api + _TRIGGER_ID: 5769c5a8-3db3-4015-a4d1-0e1d21ba0561 + _DEPLOY_REGION: asia-northeast1 + _AR_HOSTNAME: asia-northeast1-docker.pkg.dev +tags: + - gcp-cloud-build-deploy-cloud-run + - gcp-cloud-build-deploy-cloud-run-managed + - demo-backend-api \ No newline at end of file