What is CI/CD?

CI/CD stands for Continuous Integration and Continuous Deployment. It’s a software development practice where code changes are automatically tested and deployed, ensuring faster and more reliable software releases.

Let’s use this blog to demonstrate CI/CD

I am using the HUGO platform to easily create my blog, it requires a build command to convert the Markdown to HTML. So each time I push changes to my blog’s repo, it triggers a jenkins job that downloads the new commit, builds the site and publishes it to the web server. Here are the general steps:

  • Coding: I write and periodically update my blog posts.
  • Source Control Management (SCM): I push changes to my blog repository, which triggers a new build. Each push sends a Webhook to my CI/CD server initiating the Build.
  • Build: The CI/CD server receives the Webhook from my GitHub repository, initiating the CI/CD Pipeline mapped to it. The Pipeline pulls the code from the repository, runs the build command to generate the blog’s HTML files, and produces an artifact—a folder containing my blog’s content.
  • Deploy/Publish: The Pipeline then uses rsync to sync the newly created folder to the web server, completing the deployment process.

Now, in a real life scenario when dealing with an actual app/service, once the build is complete, there might be linting and testing steps that might involve other testing enviorments to ensure everything went well with the build and only then, will the pipeline deploy the application/service. However, since we’re dealing with blog posts here, no other steps are really required. Of course, if one of the steps above fails, the job is then marked as failed and reports are generated as to why the job failed so we can troubleshoot.

Other steps

You can imagine that each stack of technology will merrit its own pipeline style and commands. When dealing with containers you’ll use the docker or containerd commands to build and deploy your images, if you’re dealing with a NodeJS project, you’ll find yourself using npm and pm2, and for other use cases you’ll use other commands.

Summary

So… basically, a CI/CD job or pipeline, is the automated process of the things you’ll have to do manually, each time code is pushed and needs to be tested and published/deployed. Since we’re coding everything.. THAT TOO (the jobs), can be managed using SCM for ease of use. Now, let me push this new post and watch Jenkins (my CI/CD tool of choice) update my blog.