What is CI/CD? Where can I use it?
Hello everyone!
In this article I’m going to talk about CI/CD and about Gitlab, an amazing solution to start (and keep) using CI/CD.
Continuous Integration
Continuous Integration, or just CI as is known, “is a software development practice in which you build and test software every time a developer pushes code to the application, and it happens several times a day.”
Basically, when you push code to your code repository, it starts a process that will get the code you just pushed and builds your solution, according to your language or platform and runs automated tests on your code. And here I mean unit test, integration test, etc. It depends on what you want actually! You configure it.
Why is it important or necessary? Imagine you working in a team with other 5 people, and all you guys working in the same codes, changing everything in the same time. Alright, each one could make sure the code he/she is working on is integrated with the code in the repository, run the tests, etc., but in his/her machine, manually. If you have this automated, it’s so much better. And besides that, you will be totally guaranteed that the necessary validations and processes are going to be checked.
And other point to have attention is about testing. If you don’t have your code tested, it doesn’t make too much sense have CI, in my opinion.
Well, CI is a primary practice if you want to disseminate DevOps and Agile culture in your team. It’s a beginning and the first step to later achieve Continuous Delivery.
Continuos Delivery
Continuous Delivery, or just CD as is known, “is a software engineering approach in which continuous integration, automated testing, and automated deployment capabilities allow software to be developed and deployed rapidly, reliably and repeatedly with minimal human intervention. Still, the deployment to production is defined strategically and triggered manually.”
See that the deploy is automated but still triggered by a human. I’d say it’s half automated. It’s considered automated because the only thing the person need to do is to click a button, and everything else is made automatically.
Why is it important or necessary? Imagine your team is working all week days on the code, keeping everything integrated and tested via CI and the business you support needs your team to deploy to production environment each 2 or 3 days, or even each 2 weeks. What if beyond that, each time you need to deploy 4 or 5 applications? Someone would need to stop its work for some hours to handle that deployment work. With a CD configuration, clicking in some buttons would be all the work the deployer would have. And interesting: anyone could do that work, even a non technical person.
So, with CD you make the team focus on development instead of deployment, although the second is important as well.
Can you see the Agile Principles being applied here? If you don’t know them, check https://www.agilealliance.org/agile101/12-principles-behind-the-agile-manifesto/.
Well, to a production environment the Continuous Delivery is very interesting, because you can get the software deployed to production “as soon as it’s ready with as little human intervention as possible”. But what if I don’t want to touch anything to have it deployed? To a staging environment for instance? For this we have Continuous Deployment.
Continuous Deployment
Continuous Deployment, also known as CD, “is a software development practice in which every code change goes through the entire pipeline and is put into production automatically, resulting in many production deployments every day. It does everything that Continuous Delivery does, but the process is fully automated, there’s no human intervention at all”.
Oh yeah! Totally automated! Excellent!
But be careful! To achieve this with excellence you must have a super high level of maturity in your team, I mean excellent quality of code, good code coverage, good test coverage, a well defined development process, otherwise you could send a drastic bug direct to production! And you do not want this, believe me.
So, I’d recommend you starting the continuous deployment to a testing or staging environment only, and this will already give you a big advantage.
Well, very nice, how can I put all this to work? If you search on internet, you’ll find several tools and applications that can help you. Today I’m going to suggest you take a look on Gitlab.
Gitlab
Don’t you know Gitlab yet? Check https://about.gitlab.com/.
Gitlab is a very interesting application, with several tools and features to help and support the developers in their DevOps process.
“From project planning and source code management to CI/CD and monitoring, GitLab is a single application for the complete DevOps lifecycle.” (gitlab.com)
You can host your own instance on-premises or in the public cloud or even use SaaS offering hosted by GitLab! And believe, both have a free option! Check https://about.gitlab.com/pricing/.
Some quotes above are from https://about.gitlab.com/2016/08/05/continuous-integration-delivery-and-deployment-with-gitlab/, where you can find more information about what CI/CD is.
In their website we can see the image below, that shows exactly where is CI and CD in the entire process and what is involved with each one:
This image and a lot of more information about CI/CD and Gitlab you can find in https://docs.gitlab.com/ee/ci/.
Conclusion
CI stands for continuous integration and CD can be continuous delivery or continuous deployment. Continuous delivery still needs a minimal human interaction and continuous deployment is totally automated.
Gitlab is one of several applications that can help you configuring CI/CD.
And you may be thinking: Is it possible to have CI/CD with that language or platform I work with? Probably yes! Check https://docs.gitlab.com/ee/ci/examples/.
In this link we can’t find example for .NET applications, and it also isn’t that easy to find content that explain how to configure it with .NET.
So, in the next articles I will be writing I will show a very simple example of CI/CD with .NET and Gitlab. It will be basic, but I believe it will give an idea of what is possible to do with Gitlab.
If you have other understanding about this subject, please let us know, leave your comments!
I hope I could help you!
Bye!
Founder na Beta Learning, Investidor, Board Member.
6 年Thanks for sharing, congrats man!?