CI/CD pipeline, little details.

ยท

3 min read

"This article is based on my experience using GitHub, CircleCI and AWS"

"CI: Continues Integration, CD: Continues Deployment"

CI/CD pipeline is actually not a physical pipeline but a transfer of code and commands from one computer/virtual machine to another. The first part of the pipeline is usually your local computer the second part is your code repository the third part is the computer/virtual machine extracting your code from the warehouse to run all the commands in your configuration file while the final part is your preferred cloud host. While some cloud hosts have a complete built-in system in which you can go from the repository to the computer/virtual machine others don't.

From GitHub to CircleCI

Code moves from Github to CircleCI right after a new push is made into the repository, and this triggers a new job to start running on CircleCI. One thing that actually took time before I understood was the ability to ssh into the virtual machine running the job on CircleCI, after knowing this it was much easier to troubleshoot after a job fails.

CI phase

This phase is mainly for checking the standard of the code written by the development team for vulnerabilities and it consists of three parts

  • Building: producing an artefact from the code, this is done by typing the command

    
    npm install
    npm run build
    
  • Testing: automated test to verify code quality, this is done by typing the command

    
    npm install
    npm run test
    
  • Analyzing: static analysis and dependencies checking on the code, this is done by typing the command

    npm install            
    npm audit --audit-level=critical
    

CD phase

This phase is for copying pre-built app files to an instance and server provisioning, this phase requires a lot of attention because it comes with service creation which if not done correctly will lead to incurred bills by the cloud provider. This phase includes

  • Infrastructure creation: the creation of the necessary tools for running a secure, scalable and highly available application

  • Infrastructure configuration: configuration of the provisioned infrastructure to satisfy all the objectives

  • Deployment of the application: copying the application either monolithic or a Microservice to the just provisioned infrastructure for testing before promoting it to production.

  • Smoke testing: Smoke testing is the preliminary check of the software after a build and before a release.

  • Deploying Cloudfront: Amazon CloudFront is a content delivery network operated by Amazon Web Services. Content delivery networks provide a globally-distributed network of proxy servers that cache content, such as web videos or other bulky media, more locally to consumers, thus improving access speed for downloading the content.

Note: Ansible was used for configuration management!

Thanks for your time ๐Ÿ‘๐Ÿฝ

ย