In recent times I have got many requests asking how to answer this question. In this article, I will try to answer it in two ways. So let’s start with How will you set up a CI/CD pipeline?
If we look closely we have the following things that can construct a CI CD pipeline.
A Code Repository that can keep the revisions.
This is a code versioning system where you push the code and manage the code. This is a very important piece as this enables you to work in bigger teams on the same project in parallel. There are standards that you should always follow while making a commit or merging code. You can also follow git-flow they try to implement the standards.
A build system that can run the test cases on commits, these are generally built into Code Repository
You must have heard the name Jenkins or Rundeck . You can use any of these as a build system. The use case of the build system here is to run the tests. You can also find these runners in some code repo systems also as GitLab gives you the option to have a runner to run the test or execute other scripts.
Building the artifacts
This step is where you build the final package that will get deployed. These can be tar, docker images, Debian packages, python packages, or other ones. This system can again be Jenkins or Rundeck or other such systems. After building you have to make sure that you push it to the artifact repository from where they will be served
Serving the artifacts
Cluster Orchestrator and deployer
This is generally a combination of two things. A place where your workload will run and the tool that will deploy it.
For the place where you can run your workload. If you are using the containers approach you can use kubernetes, mesos or docker swarm. Otherwise, you have to go with the machines where artifacts will get deployed.
Now comes how will those get deployed. You have tools like chef, puppet, salt, ansible. You can use any of these to install and deploy your artifacts. With Kubernetes you just have to apply the YAML files so you can have a small script that does and you will not need any of these tools.
Managing your secrets
Managing your secrets is a very important part of the Continous integration pipeline and its sometimes not easy to do this. You can find tools like hashicorp vault, secrets stores that are also present in all the public clouds. Kubernetes secrets are also a way to manage secrets but they are actually just encoded. You can also use chef, puppet etc to deliver the secrets to the machines. The chef can do it using encrypted data bags.
There are two parts, first is CI which is continuous integration which means whenever there is a commit, automation will run to make sure that the commit adheres to the rules and guidelines defined by the system and are well written. CI runs automatically and makes sure that each and every commit can be merged to master without any extra tests. Next is CD which is continuous delivery, CD is when you actually deploy the build to the production. I will recommend the following approvals in these steps. You can have CI to merge everything but keep and approval or trigger to actually deploy it.
Not that this answer does not include the part where you mention the strategy to launch and provision your infra to run the CI-CD pipeline on. If you want to read about how you can provision your infrastructure you can read the below articles.
If you like the articles please share and subscribe.