What is CICD Pipeline? CICD process explained with Hands On Project
82.26k views2645 WordsCopy TextShare
Cloud Champ
What is CICD Pipeline? Why you should Learn CICD as a DevOps engineer?
CICD or Continuos Integratio...
Video Transcript:
what is cicd this is one of the most asked devops interviews question and also a very popular devops practice that every company is following these days now if I ask you what is CI CD process most of you will stop by saying it is a continuous integration and continuous deployment process or you might see a complex definition from a blog or a website that might not make sense so in this video I am going to explain you what is cicd in very simple manner along with different stages in cicd pipeline benefits of using CI CD in devops some popular CX data tools and also a Hands-On demo to set up cicd pipeline for a python application using GitHub actions if you want to understand CSD completely make sure you watch this video till the end and also practice by doing Hands-On demo that you have in the end if you are new to my Channel Please Subscribe let's start so let's begin with what acicd and I am going to explain you this in very simple and short manner so cic is a way to make software faster safer and efficient by streamlining and automating process like building testing and delivering of the software to understand this properly let's look at the traditional way of deploying an application or a website without using CI CD so imagine you are working in the team responsible for deployed application without using CI CD and to do that there are going to be different phases or stages the first phase is going to be the coding phase or development phase where the developers are going to write the code for the application and there can be multiple developers site in the code so they need to make sure that the code is integrated at a central page which can be done using FTP to manually put the code on a synthesized server or they might use Version Control Systems like git so they can store their application code on GitHub auditlab now when the source code is ready they need to compile it which is known as compilation space where you combine file the code to create a build a where is something which has code along with dependencies libraries which runs the software Android code will have APK as a built Java code has jar or Wi-Fi is built Docker image is also one kind of pink now when the brick is ready and your software is running as you expected you need to test it out the third phase is testing phase here the QA Engineers are going to manually test the application to make sure everything is working fine and this is also a manual process once the testing is done and everything is okay you need to plan the deployment now is the deployment space so in this you need to set up a staging server which should replicate the exact production environment and you will deploy your build or your application in this staging server you need to manually check and test out if everything is working in the staging server before you deploy your application on the production environment if everything is working as you want on the staging server you will plan a maintenance window order downtime to deploy an application on production after deployment to production is done and your application is up you still need to create a new monitoring and testing manually to make sure that your application is working fine but if there are any issues you need to manually roll back and go back to the previous version so you see there are so many manual processes there are so many human interventions which can cause issues and errors in the deployment process not just this if you wanted to play a new version of your application you will have to continue the same cycle again and again this can cause so much issues and can take so much time this is why companies are using cicd because cicd can automate all this process it can automate the building testing and deploying of an application so now let's look at the definition CI CD stands for continuous integration and continuous digivz also a continuous deployment which is a devops process to automate software delivery using cicd pipeline you can build code run test and save the deploy your applications on various different platforms or Cloud environments so now you know cicd is a process of continuous integration continuous delivery and continuous deployment but what is actually continuous integration so continuous integration is a process in CI CD pipeline where the members are going to integrate their work or push their code on Center repository systems where their code or their work is going to be checked automatically tested out next is continuous delivery where you compile the code that you got from the repository and you create the build test it out and be readily deployed continuous delivery is a process of making sure that the software is ready and it can be released anytime you want last one is continuous deployment which is the process of deploying your application or a software or you have built all the cloud or servers or kubernetes cluster whatever you intend to this is used to automatically deploy new features and new versions of your application whenever the code is integrated in the repository and then it can be deployed on any server whenever you push it this three process together creates a chcd pipeline a cicd pipeline will have different stages including Source stage build stage test stage and deploy stage the first one is solar stage which is the starting point of the cicd pipeline when any change is made into your code and pushed to your repository a CSD python will be triggered to go into next stage which is the build stage now what happens in the bin stage in the bin stage your code is combined with dependencies and libraries to create a build or an artifact that can be deployed in your in your platform but after the build is created it is going to go in the next stage which is the test stage in the test stage there are going to be automated tests to test your application code and to check if it behaves correctly if there are any issues to your application you can find them in your test stage and also resolve them once the test day is done it is going to move to the next stage which is the deploy stage finally in the deploy stage your application goes light because in this your application will be deployed on a server after it has passed all the tests and everything works as you want so these are all the different stages in cicd pipeline now that you understand what a cicd and different state is in cicd Pipeline and before we move a while to look at popular CX tools along with Hands-On let's look at the benefits of using cicd Concepts in your application deployment the first benefit is obviously quicker time to Market using cicd we can automate the process reduce manual Intervention which allows us to deploy application faster and bring software releases quicker second is higher quantity automated testing in cicd can help us find buns and issues early in the development process third is reduced risk using cicd we can push smaller changes and more frequent updates which are less likely to cause major problems or bring production down for this collaboration using cicd developers testers and operation teams can collaborate more effectively another benefit could be continuous Improvement the syntax that you get throughout the cicd stages can be useful to improve future releases these are just some of the benefits that you can get through cicd but there are many big companies that have seen drastic changes after implementing cicd so companies like HC Netflix Adobe deploy more than 50 times every day not just this Amazon deploys new releases every 11. 7 seconds and this is Possible only through CI CD now let's look at some of the popular search Tools in devops some popular cxd tools in devops include Jenkins gitlab CI GitHub actions Travis CI AWS code pipeline Azure devops Services team CT bamboo and lot more your company might be using any of these tools which can depend on the requirement if you want to learn CCT I would recommend you doing with with either Jenkins or gitlab or GitHub which I'm one of the most used the ICA tools in the market right now now that you understand what is CI CD along with its benefits and different stages of it let's do a Hands-On demo to set up cicd pipeline for a python application on GitHub let's go all right so I'm here on my computer screen and I have GitHub actions open here GitHub actions is a very popular CI CD tool that you can use to automate building testing and deploying of your application for this demo I have a very simple python application created using flask module to show us hello world message on our website and this application is containerized so I'm creating a Docker container using this topify and uploading it on my Docker Hub repository here so if I were to do this manually I need to run the commands Docker build Docker uh push to push this image on Docker app but I'm going to automate all of it along with some test so I have a test dot Pi if I created to run the test on this particular application so this in this test file I am running a test to check that the message should always be hello world and if it is something else than hello world you should give an error you can see there's a function created to check that the test should always have hello world and it should also have a 200 series code so now to test this out I am going to change make some change in app. pi but before I do that let me show you the CI CD pipeline file so here is the CHP file the name is cicd Pipeline and it will be triggered whenever this push made on the main branch now in this there are two jobs the first is a build job and then there's a test job in the build job there are some steps here and this cha pipeline is going to run on Ubuntu latest a few steps like check out the code log into Docker Hub you can see this this command going to run I also need to put username and password in my secrets so you can do that by going into settings I'll show you that in a second after this I am going to build tag and push the image to Docker up so when the app is ready the CHD pipeline is going to go ahead and create a image and push it on Docker up to show that in action I'm going to go ahead and delete this repository so I'll go here and delete this repository to make sure that cicd pipeline will create a new image whenever there's a push made to our Repository so I'm going to go ahead type my image to delete this okay and this will go ahead and delete it now when the build is done it is going to test the code so it will test by check out the code so then install dependencies in requirement.
txt and then using pi test I am going to test the so here in this we have a test created let's go ahead and try that out so in my app. pi I'm going to make a change here instead of hello world I'll say hello CI CD world so let's make it c i c d world I'm going to commit and push this change now so update app.