CI/CD in 3 minutes
Technology is advancing at a good pace and anyone who is not adapted to latest tools and technologies may soon feel competition from their peers. From this blog onwards, I will pick one topic and try to explain it in as simple as possible.
CI/CD is a very important aspect in software development and any software engineer from a junior level to a senior level knows the importance of CI/CD pipeline especially in agile methodologies. Without wasting any more time let’s go the crisp of CI/CD in 5 minutes.
Now I will go through each of the block in Fig 1 where the developer block is any developer who pushes some code and production is the final mobile application/webapp which our user uses:
- Source Control Management: Source control or version control is nothing but a way to track and manage the codes pushed by multiple collaborators. For example Github is a classical source control management system.
- Build: It is the block where the compilation of our code takes place and the output from the build block is a package (may be .jar file or anything based on the framework we use). In this block the following task are done mainly:
- Compilation of our code
- Unit tests
- Static code analysis
Now a question may be coming in your mind what is unit test and static code analysis. Unit test is a level of testing where we test our components at individual level. For example you write a function which prints “Hello world”. The unit test for this function will be to write a testing unit which will check our function and verifies, that it always prints “Hello World”. I know it’s bit difficult to understand but don’t worry I will come back with a complete series on unit testing in various famous frameworks. Coming to static code analysis, it is a procedure of checking our source code against some predefined rules before the compilation. For example, checking the casing of our variables i.e it is camelCase or PascalCase.
3. Release: From the package output from the build block, in the release block we perform the following task:
- Deployment of app
- Integration Testing
- QA testing
The deployment of app can be think as the sending the code for production or UAT / DEV testing environments. In dev environment only a few people from the organization test the app but in UAT testing 100 to 1000 people test the app. A popular example of UAT testing is the release of something in beta version. When the beta version works fine then the app is sent to production.
Now you may be thinking till now I am speaking only about build and release where is CI and CD. So, breaking the suspense Continuous Integration is the complete process from SCM to build like static code analysis , unit testing etc, and Continuous Deployment is the complete process build to release.
In summing up we can say when we do a pull request or any code change to the master we want to trigger the build, which is CI pipeline and when we want to deploy the app in production we trigger the CD pipeline.
Popular tools for CI/CD are as follows:
- Jenkins : The most popular tool for CI/CD
- Azure Devops: Quite handy to use with azure and my personal favorite
- Gitlab CI: Quite popular
- Circle CI: Had a great feature of Automated builds but the free tier does not give that much freedom to the user.
Note: In this blog I tried to explain the CI/CD process in a very simple way. For not complicating things I considered only developers but in an organization there are also Database Administrators (develops the SQl scripts) and the IT people (automates and manages the infrastructure with tools like Terraform, ansible, chef, puppet etc) who also adds their script in source control and corresponding step happens in the build and release stage.
For any questions or queries mail me at subhamkundu999@gmail.com
Who am I?
A tech geek by passion who loves to explore new technologies.