Skip to main content
In this lesson, we’ll recap the complete end-to-end CI/CD setup using Google Cloud Build, GitHub, and Artifact Registry. Once configured, any push to the main branch will automatically build and publish your Docker image.

Pipeline Overview

Ensure your GitHub repo is connected to Cloud Build and you have permissions on the Artifact Registry.

1. Update cloudbuild.yaml

Place this file in the root of your repository to define your build pipeline. Example configuration:

2. Commit to GitHub

Save your changes and push to a feature branch:

3. Open a Pull Request

In GitHub, open a PR from feature/ci-cd-setup into main. Assign reviewers to validate:
  • Review cloudbuild.yaml
  • Check naming and region settings
  • Verify IAM permissions for Cloud Build

4. Merge into Main

Once approved, merge the PR. Cloud Build only triggers on commits to the main branch.
Avoid merging untested changes directly into main. Always validate in a staging or development branch first.

5. Trigger Cloud Build

After merging, Cloud Build detects the new commit on main and executes your defined steps. Monitor builds via:
Or in the Cloud Console under Cloud BuildHistory.

6. Build and Publish Docker Image

Cloud Build will:
  1. Build the Docker image.
  2. Push it to Artifact Registry in the specified region (e.g., us-central1).
With artifacts versioned and stored securely, your pipeline is now fully automated.

References

Watch Video