Operation
Google Serverless CI/CD
What is Serverless CI/CD?
Serverless computing is a modern method of software delivery that eliminates the overhead of managing server resources. It is an advancement brought by cloud computing to make developers' lives easier. CI/CD is an acronym that combines two concepts: Continuous Integration and Continuous Deployment. CI/CD is also a modern software delivery method where you continuously build, test, and deploy your software live to end users. Serverless computing is at the heart of Google Cloud. To simplify the developer experience, Google Cloud continuously releases tools that allow you to build, develop, and deploy functions and applications without having to worry about infrastructure management. To support serverless CI/CD in the context of Google Cloud, a tool called Cloud Build was released.
Cloud Build is a tool that builds your code on the Google Cloud Platform. It can import source code from various repositories, such as GitHub, Bitbucket, or private Git Repositories hosted on Google Cloud. From your source code, Cloud Build can produce various artefacts such as Docker containers ready for live deployment, or Java archives.
How Serverless CI/CD Works in Google Cloud?
Cloud Build follows a series of defined build steps to execute a complete build cycle. You can define these build steps based on your source code structure or use the supported Cloud Build steps.
To configure your project for CI/CD, you first need to set up a Git repository to which you will push your source code changes. The next step is to open your GCP project and search for Cloud Build. In the Cloud Build interface, you then create a Cloud Build Trigger. Within this trigger, the source repository must be specified.
The trigger is a crucial part of the CI/CD process. When adding the trigger in Cloud Build, you have the option to specify a branch. If you specify a branch, the trigger fires whenever you push to that branch. If you do not specify a branch, any change to any branch triggers Cloud Build.
Once you have linked your source repository, you now need to specify the build steps. The build steps are defined in a YAML file named cloudbuild.yaml within your repository. The build steps are instructions such as which dependencies to install, which tests to run, and finally deploying the built artefacts to live systems if the tests pass. Whenever you push new source code to your Git repository, Cloud Build automatically reads the cloudbuild.yaml file and executes the build steps.
Benefits of Serverless CI/CD in Google Cloud
Saves development time. The serverless nature of Cloud Build means your development team does not need to worry about managing server infrastructure. Once you have configured your build triggers, you will only be concerned with writing your code and pushing it to the Git repository.
Great cost-saving opportunities, as you only pay for the compute resources your CI/CD pipeline consumes when Cloud Build is triggered. This is especially true if you only build infrequently.
Automatic scaling. Google Cloud manages the Cloud Build resources and automatically scales the infrastructure to enable execution and ensure your build process does not fail.
You can configure Cloud Build to run ongoing Cloud Function tests on your code to ensure it continues to work as expected and dependencies remain up to date.



