Google Cloud Platform (GCP) -  CI/CD pipeline basics for beginners - Learn to build simple devops ci/cd pipeline on GCP (2021)



 And see, it has now changed to Hello YouTube. I am new version of you. That means that without me doing anything automatically, the code changes were made and the new version was deployed automatically. So this is continuous integration and continuous deployment. This is what it is in a very, very simple manner.


about CI CD pipeline. So this is the topic for today. We will understand what is CI CD? In a nutshell, we'll understand what are the advantages of implementing a CI CD pipeline.


And then we will see how we can implement CICD using Google Cloud platform. All the products on Google Cloud platform, a very simple CICD pipeline. And we'll do a live demo of this on my console. So I'm very excited to share this learning with you and hope it will be useful for you. So without further Ado, let's get started.


So what is CI CD? So CI CD, as the name suggests, is continuous integration, continuous delivery, and continuous deployment. And this is a framework which comes under DevOps software development framework. If you do not know a world about DevOps, I have made a very simple video, a three minute video which you should check out where I've tried explaining why today in today's world we need more and more DevOps framework. There are very, very clear advantages of using DevOps and within DevOps.


When you have this CI CD pipeline, it helps you create a seamless software development framework which is very agile in nature, which is very, very rapid. The kind of changes which you deploy are very quick. So what exactly happens in this particular framework? So in this particular framework, right from the left side of your pipeline, we are actually a developer sits a developer codes and application towards the most right side of the pipeline where actually the production code is deployed and maintained by the support guys. This whole pipeline is very, very nicely integrated with the help of some products, some open source products and frameworks and processes with which this whole seamless integration happens and deployment happens.


So continuous integration, as I have said, it is a code check in and build, which you do several times a day. And why DevOps is better because like in agile method, you will have monthly sprints. Right. But or maybe weekly sprints or two weekly sprints. But in DevOps, you can have release cycles multiple times in a day.


And that helps because suppose if you are working on a production application which needs continuous changes and where the developers need to build more and more changes into the pipeline, then in that case, you will need this kind of a framework. Okay, you will need this kind of a framework. And what is continuous delivery? Continuous delivery means that once your code is ready, you put that code into your repository where it can be further tested, the integration testing and the UAT testing, everything can happen. And under continuous delivery and continuous deployment, there is a confusion between what is continuous delivery and what is continuous deployment.


These are slightly different because when you say continuous delivery, it means that you are putting the code, you're building the code, you're triggering the build, and you're testing it out. But you're not actually doing the deployment of that code into production. And in places where you know, the applications are very critical, and you cannot falter with any kind of a production running application, you stop at continuous delivery level and you have a manual intervention at that point. And when that is validated, then only it is deployed.


Wherein at places where you have the seamless deployment, it means that the right from any change which is made from from the developer side, it merges into your deposit free, get tested, get built, and then it gets deployed directly.


So it is what it is. It is very simple, and there are multiple ways to do it. Okay. But it is recommended that you first implement continuous integration, and then only you go and build the foundation for your continuous deployment, because continuous delivery and deployment are more business facing and it might impact more on the business. So suppose he is your developer and he checks in code.


Okay. And this particular code then goes and gets loaded into your report. Okay. So a testing can be happening here. Also here.


Also, the testing can happen. But after that, in this particular repository, when it commits the changes, the developer commits any changes. This particular change triggers the bill. Okay. So this build is triggered automatically with the help of the software.


And then whatever changes are made goes under this. And then there is a set of testing happening here as well. So what happens is that once this is developed and once this particular build is tested successfully, then it will be delivered, delivered as the final product in your repository. Okay. And then finally here it will be deployed in production.


Okay. So you can see this whole flow. Okay. So you can take it like this. So.


So you can see that this particular, this particular piece here. Okay. So this is your CIP continuous integration and this particular piece which you see here, this is your continuous delivery and continuous deployment. Both are different, because at places where you have very critical data, you might say that, no, we will come only till will deliver the final rate, but we will only deploy it in production, will only deploy it in production when it is thoroughly tested. And there is a business owner who approved it, approves this.


Okay. So that's why CD and this CD are different. So let's discuss why we need CI CD. What are some basic benefits which we get when we implement CI CD. The number one benefit is feed.


The rate of release is very fast in CICD, and with the kind of micro services architecture we are moving and the kind of agility we need in today's world, speed is very important. And because of this, you need a framework where a developer can develop the code very quickly, and then it can be very quickly checked in very quickly. Build very quickly, tested and delivered and deployed. Second is fault tolerant, because here we believe that we need to fail early and we need to fail small because it's very important for us to have multiple deployments going in, and it might happen that many times the developer might check in a code which will fail in between any of these stages during this pipeline, maybe during the the builder software will understand that.


Okay, there is a defect in this particular code which needs to be again, send back to the developer and all those kinds of things.


But then what happens is because you are doing the releases very frequently. The overall impact of these faults are very minimal. So that's why you fail early and you fail small. Cost reduction is again, a very big thing because there is a plethora of open source free software which you can use like Jenkins, GitHub, and there are many circle CI and all these products. We are not discussing these products in this video, but I can maybe share a link in the video description if you want to go about learning these products.


There are many. And honestly, when I am not aware of all of these products, but when you implement these kinds of products, three of costs and to apply automation, you're basically reducing your overall overhead costs, which you get for maintaining this in a manual way. The fourth and again, very important for point is transparency, because throughout your pipeline, everything is visible right from what developer is doing and then what we are facing on the production, deployed application, it is all visible via common pipeline. So these are some clear benefits which I see in CI CD.


Again, there are other security related benefits and a lot other benefits.


But for the purpose of this video, these four are the ones which I would like to discuss moving ahead. Now we'll understand that how we can implement CICD in Google Cloud and all of the products which we are using in this demo will be cloud based, completely Google Cloud. So we will take a scenario where a developer checking the code into cloud source repositories. Now, cloud source repository is a fully managed product offering which GCP provides, and it is based on top of Git repositories. But this is purely within GCP.


So once the code is checked in, it automatically will trigger the build. And then this bill will be triggered by cloud build. And cloud build again is a service which.