diff --git a/tool/build_image_proxy.yaml b/tool/build_image_proxy.yaml new file mode 100644 index 0000000000..57f55c7f1e --- /dev/null +++ b/tool/build_image_proxy.yaml @@ -0,0 +1,48 @@ +# Configuration for Google Cloud Build +# +# Triggers in the project kicks off a cloud build task based on the +# configuration in this file. Permissions granted to this task is configured +# by granting permissions to the service account: +# @cloudbuild.gserviceaccount.com +# +# Reference: https://cloud.google.com/cloud-build/docs/build-config +steps: + - name: 'gcr.io/cloud-builders/docker' + script: | + #!/usr/bin/env bash + set -x + if [[ "$PROJECT_ID" != dartlang-pub && "$PROJECT_ID" != dartlang-pub-dev]]; then + echo 'Only deploy from the dartlang-pub project' + exit 1; + fi + if [[ "$TAG_NAME" != image_proxy-* ]]; then + echo 'This script is only intended for use on image_proxy- tags' + exit 1; + fi + docker build -t us-central1-docker.pkg.dev/$PROJECT_ID/image-proxy-server:$TAG_NAME . --file pkg/image_proxy/Dockerfile + docker push us-central1-docker.pkg.dev/$PROJECT_ID/image-proxy-server:$TAG_NAME + env: + - 'PROJECT_ID=$PROJECT_ID' + - 'BRANCH_NAME=$BRANCH_NAME' + - 'TAG_NAME=$TAG_NAME' + - name: 'gcr.io/google-cloud-sdk' + script: | + #!/usr/bin/env bash + set -x + if [[ "$PROJECT_ID" != dartlang-pub ]]; then + echo 'Only deploy from the dartlang-pub project' + exit 1; + fi + if [[ "$TAG_NAME" != image_proxy-* ]]; then + echo 'This script is only intended for use on image_proxy- tags' + exit 1; + fi + gcloud run deploy image-proxy-server \ + --image="us-central1-docker.pkg.dev/$PROJECT_ID/image-proxy-server:$TAG_NAME" \ + --region="us-central1" \ + --platform="managed" \ + --quiet + env: + - 'PROJECT_ID=$PROJECT_ID' + - 'TAG_NAME=$TAG_NAME' +timeout: '5400s'