Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,30 @@ substitutions:
_TOKEN_EXCHANGE_URL: https://auth.mlab-sandbox.measurementlab.net/v0/token/integration

steps:
# 1. Build the container image
# 1. Pull cached image (if exists) for layer caching
- name: "gcr.io/cloud-builders/docker"
id: PullCache
entrypoint: bash
args: ["-c", "docker pull ${_REGION}-docker.pkg.dev/${PROJECT_ID}/m-lab/${_SERVICE_NAME}:latest || exit 0"]

# 2. Build the container image with cache
- name: "gcr.io/cloud-builders/docker"
id: Build
args: ["build", "-t", "${_REGION}-docker.pkg.dev/${PROJECT_ID}/m-lab/${_SERVICE_NAME}:$BUILD_ID", "-t", "${_REGION}-docker.pkg.dev/${PROJECT_ID}/m-lab/${_SERVICE_NAME}:latest", "."]
args: [
"build",
"-t", "${_REGION}-docker.pkg.dev/${PROJECT_ID}/m-lab/${_SERVICE_NAME}:$BUILD_ID",
"-t", "${_REGION}-docker.pkg.dev/${PROJECT_ID}/m-lab/${_SERVICE_NAME}:latest",
"--cache-from", "${_REGION}-docker.pkg.dev/${PROJECT_ID}/m-lab/${_SERVICE_NAME}:latest",
"."
]

# 2. Push to Artifact Registry
# 3. Push to Artifact Registry
- name: "gcr.io/cloud-builders/docker"
id: Push
args: ["push", "${_REGION}-docker.pkg.dev/${PROJECT_ID}/m-lab/${_SERVICE_NAME}:${BUILD_ID}"]
waitFor: ["Build"]

# 3. Deploy to Cloud Run
# 4. Deploy to Cloud Run
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
id: Deploy
entrypoint: gcloud
Expand Down
Loading