Google Serverless CI/CD
What is Serverless CI/CD?
Serverless computing is a modern software delivery method that takes away the overhead of managing server resources. It’s an advancement brought about by Cloud Computing to make the life of developers easier. CI/CD is an abbreviation that combines two concepts: Continuous Integration and Continuous Deployment. CI/CD is also a modern software delivery method in which you are continuously building, testing, and deploying 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 to let you build, develop, and deploy functions and applications without the hassle of infrastructure management. To support serverless CI/CD in Google Cloud context a tool called Cloud Build has been 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 artifacts 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 the structure of your source code or use the supported cloud build steps.
To configure your project for CI/CD you first need to set up a Git repository where you will be pushing 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 needs to 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 do specify a branch, the trigger will be fired when you push to that branch. When you do not specify a branch, any change to any branch will trigger Cloud Build.
Once you have linked your source repository, you must now specify the build steps. The build steps are specified in a YAML file called cloudbuild.yaml inside your repository. The build steps are instructions such as what dependencies to install, what tests to run and eventually deploying the built artifacts to live systems if the tests are successful. 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 time on development. The serverless nature of Cloud Build means your developer team will not have to worry about managing the 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 options since you only pay for the computing resources your CI/CD pipeline will use when Cloud Build is triggered. This is especially true if you only build very infrequently.
- Automatic scaling. Google Cloud manages Cloud Build resources and will automatically scale the infrastructure to accommodate the execution ensuring that your build process does not fail.
- You may configure Cloud Build to run Cloud Function tests on your code on an ongoing basis to ensure your code continues to work as expected and the dependencies remain up-to-date.
You may also like…
Google Cloud BeyondCorp
BeyondCorp Enterprise is a Google Cloud offering that solves this problem. It works exclusively to provide end-to-end protection to both, on-premise application…
Blockchain on the Google Cloud
Blockchain, which has experienced exponential growth over the last decade, needs GCP services to cater to the resource overloads resulting from its growth.
Data lineage encompasses tracing data from its source and the transformations it may undergo to reach its target. It generates a link between single and multiple…