Triggering a CI/CD Pipeline with Google Cloud Build

Get Started
45 minutes
  • 5 Learning Objectives

About this Hands-on Lab

Whether you are implementing a traditional DevOps or a more Google-based SRE approach to app or service production, automation is key. Google Cloud makes it possible to quickly and easily establish a CI/CD pipeline that triggers the entire process of deployment every time a specific source code repository is updated. This automation reduces the time required for the entire operation as well as eliminating the potential for human error when pushing the code live. In this hands-on lab, you’ll see how to combine Google’s Cloud Source Repositories, Cloud Run, and Cloud Build services to create and test such a CI/CD pipeline.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Enable APIs.
  1. Enable the necessary APIs for Cloud Source Repositories, Cloud Run, and Cloud Build.
Develop the source repository.
  1. Create a Cloud Source Repository named automate pipeline.
  2. In Cloud Shell, clone the repo.
  3. Pull the app files from the GitHub repo at: https://github.com/linuxacademy/content-gcpro-devops-engineer
  4. Set up the necessary global configuration variables to use the git command.
  5. Push the cloned repo into recently created Cloud Source Repository.
  6. Confirm the Cloud Source Repository has been created with the desired files.
Integrate Cloud Run into Cloud Build.
  1. Define the PROJECT_ID variable to hold the current project ID.
  2. Enable the Cloud Run service account for Cloud Build.
Establish a Cloud Build trigger.
  1. Create a trigger to activate Cloud Build when a new commit to the source repo occurs.
  2. Make sure to use the proper path in the cloudbuild.yaml file.
Test your pipeline.
  1. Test the existing trigger.
  2. Confirm the app deployment.
  3. Make a change to the source code and push it to the repository.
  4. Confirm the app deployment.

Additional Resources

Your dev team has completed the first stage of app development, and you have been tasked with creating a CI/CD pipeline to automate deployment whenever a change is committed to the source code repo. Because your organization is all-in on Google Cloud, you opt to host the repo on Cloud Source Repository and put the app into production with the serverless Cloud Run service. In order to automate the pipeline, you'll need to integrate Cloud Run with Cloud Build and establish a commit-based trigger for Cloud Build. Naturally, once the pipeline is complete, you'll need to perform several tests to confirm the automation is working properly.

You’ll need to accomplish the following steps to complete your task:

  1. Enable necessary APIs.
  2. Create a Cloud Source Repository and then clone it to hold the code.
  3. Set up Cloud Run so that it can be automated by Cloud Build.
  4. Create a Cloud Build trigger that fires when the source code repo is updated.
  5. Test the pipeline.
What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?