CI/CD: Google Cloud Build — Pass artifacts between steps
In this article we are going to cover passing artifacts between build steps using Google Cloud Build. This will be a short and straight to the point article not covering the full range of Google Cloud Build capabilities or the Google Cloud Platform.
If you’re interested in CI/CD pipelines, then please check out our other articles which cover varying topics. Here is a short list.
- CI/CD: Introduction
- Google Cloud Build — Create/Store Docker Images via GitHub Trigger
- Google Cloud Build — Custom Scripts
- CI/CD: Google Cloud Build — Regex Build Triggers
Alright, let’s jump in!
Full file:
Below is the full cloudbuild.yaml file detailing what we will cover in this article. The CI/CD pipeline only consists of two build steps for simplicity and staying focused on passing artifacts between build steps. Enjoy.
steps:
# Step 1:
- name: 'gcr.io/cloud-builders/mvn'
entrypoint: bash
args: ['./scripts/build.bash']
volumes:
- name: 'jar'
path: /jar
# Step 2:
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: bash
args: ['./scripts/deploy.bash', '$_APP_NAME', '$_ENV_NAME', '$_REGION']
volumes:
- name: 'jar'…