cloudbuild.yaml (28 lines of code) (raw):
# Google Cloud Build script for bqutils
#
# This build script is used to deploy the open-source bqutil GitHub repository
# for every change pushed.
#
# Manual Execution:
# Use the below command to invoke the build manually. Note the substitutions for
# BRANCH_NAME and REVISION_ID. These variables are normally populated when the
# build is executed via build triggers but will be empty during manual
# execution. Dummy branch and revisions can be passed during manual execution so
# the artifacts can be uploaded upon build completion.
#
# gcloud builds submit . --config=cloudbuild.yaml
#
steps:
############################################################
# Fetches master branch from GitHub and then hard "resets"
# to the _PR_NUMBER which triggered this build. This enables
# build.sh to build only what's changed relative to the
# master branch by checking the output of "git diff".
############################################################
- name: gcr.io/cloud-builders/git
entrypoint: bash
args:
- release/git_init.sh
env:
- _REPO_URL=${_REPO_URL}
- BRANCH_NAME=${BRANCH_NAME}
- _PR_NUMBER=${_PR_NUMBER}
###########################################################
# Build and deploy
# (only deploy if triggered by a commit to master branch)
###########################################################
- name: gcr.io/$PROJECT_ID/bq_udf_ci:infrastructure-public-image-bqutil
entrypoint: bash
args:
- release/build.sh
env:
- PROJECT_ID=${PROJECT_ID}
- BRANCH_NAME=${BRANCH_NAME}
- SHORT_SHA=${SHORT_SHA}
- _JS_BUCKET=${_JS_BUCKET}
- _PR_NUMBER=${_PR_NUMBER}
- _BQ_LOCATION=${_BQ_LOCATION}
- _BUILD_IMAGE=${_BUILD_IMAGE}
substitutions:
_JS_BUCKET: gs://bqutil-lib/test_bq_js_libs/${SHORT_SHA} # default value
_REPO_URL: https://github.com/GoogleCloudPlatform/bigquery-utils.git # default value
timeout: 1800s # 30 minutes
options:
pool:
name: projects/${PROJECT_ID}/locations/us-central1/workerPools/udf-unit-testing