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