CI/CD on Google Cloud : Source Repositories and Cloud Build
Continuous Integration (CI), at its core, is about getting feedback early and often, which makes it possible to identify and correct problems early in the development process. CD is about packaging and preparing the software with the goal of delivering incremental changes to users.
Source Repositories are fully featured, private Git repositories hosted on Google Cloud. Cloud Build are serverless CI/CD platform.
This tutorial have architecture like this. The architecture used with Architecture Diagram Tool.
Let’s go. Go to CI/CD services like this. Then, click Source Repositories and redirect to new tab.
Click Get Started and click Create Repository.
Create new repository means create repository without connect external repo like GitHub, GitLab, Bitbucket and more (private repo). While connect external repository means can connect to GitHub, GitLab, Bitbucket and more. I choose connect external repository and click Continue.
Choose Google Cloud project and also Git provider. Don’t forget check statement and can connect to GitHub. Then authorize GitHub if want to next step.
After authorize GitHub, there are several repositories from my GitHub and if so, can click connect selected repository.
You can see gear symbol next “Edit code” button. Click the gear symbol.
There are 2 menu (general settings and permissions). Permissions for who that can reserve enter to Source Repositories like IAM. General settings for explain repository name, location, connected repository (like GitHub), and last synced from GitHub. You can sync from GitHub if have update/change. You also can disconnect the repository.
Click “Cloud Build Triggers” and redirect to new tab like this. Cloud Build uses build triggers to enable CI/CD automation.
Then click Create Trigger.
You can configure triggers to listen for incoming events, such as when a new commit is pushed to a repository or when a pull request is initiated, and then automatically execute a build when new events come in.
You can also configure triggers to build code on any changes to your source repository or only on changes that match certain criteria.
Fill the name, choose region (can global or regional like us-central1, asia-southeast2), description, tags (optional). Also choose event for the trigger.
Choose source repository (automatic available) and fill the branch from the repository. Choose Docker file for configuration.
Click Create button. Service account and approval are optional. You can use or not.
Trigger for the repository are is ready for run. Click RUN and you can see popup. If run trigger popup available, choose branch and click Run trigger.
Here are Cloud Build history from Source Repositories trigger and this process are successful.
Go to Container Registry services, here are is images during CI/CD process on Cloud Build and save the images in Container Registry.
Here is my tutorial about CI/CD on Google Cloud with Source Repositories and Cloud Build. Don’t worry. I will write again about CI/CD. Thank you very much. Happy reading :)
- Source Repositories : https://cloud.google.com/source-repositories/docs
- Cloud Build : https://cloud.google.com/build
- Container Registry : https://cloud.google.com/container-registry
- CI/CD on Google Cloud : https://cloud.google.com/docs/ci-cd