Back

Wednesday, 30 October 2024 | 17:01 | Author by Hasbi Kholifatul Ashshidiq

A Practical Guide to CI/CD: From Integration to Deployment

Overview

CI/CD, short for continuous integration and continuous deployment, aims to streamline and accelerate the software development lifecycle.


Why CI/CD?

  • Speed: CI/CD pipelines help developers make code changes as quickly and frequently as possible.
  • Increased productivity: Deploying more frequently means you can deliver new features and bug fixes to users faster, which increases customer satisfaction.
  • Reduced risk: A CI/CD pipeline will help you catch bugs earlier in the development process before the code reaches production. You want to deploy frequently, but you also don't want to send bugs to your users frequently - CI/CD will reduce the risk of doing so.
  • Higher quality: Fixing issues earlier in the development cycle means you'll be able to deliver high-quality features or fixes to your users.


What is CI/CD?

CI/CD consists of two parts, CI (continuous integration) and CD (continuous delivery/deployment).

  • CI: refers to the building and unit testing stages of the software release process. Every committed revision/change will trigger the build and unit testing automatically.
  • CD: refers to the release stage in the software development process. This release stage is done with a build artifact that is ready to be deployed and has passed a standardized testing process.


Important Concepts



  • Trigger
    Something that triggers the pipeline to run
  • Pipeline
    A workflow of a CI or CD process consisting of one or more stages.
  • Stage
    A stage is the logical boundary of a pipeline. Usually used for separation of interests for example (Build, staging, and production). Consists of one or more jobs
  • Job
    A job represents the execution boundary of a series of steps. Job separation is usually done if there is a need to run a series of steps in different environments.. Each job runs on a single agent
  • Step
    Is the smallest block of the pipeline, for example in one job there is a step that runs the build and there is a step that runs testing. Steps can contain tasks or scripts
  • Agent
    A computer infrastructure with agent software that runs the job

So, the trigger will trigger the pipeline to run which consists of several stages and in the stage there are several jobs run by the agent and these jobs consist of steps that contain instructions or scripts.


CI In Practice

In this example, we use azure devops to create a pipeline in CI. First, click new pipeline on the pipelines menu page.




Then connect your repository with the pipeline, in this example we will use a YAML file to configure the pipeline. If you don't want to use a YAML file, you can click Use the classic editor.


After connecting the repo, you will reach the Configure step:


Select the pipeline starter to use the empty template yaml file.


Then we configure this pipeline file such as triggers, agents, build steps as needed. The image below is an example of a yaml file for build and push images using docker with trigger tags that start with v *:


When finished, save the configuration by pressing the save and run button, then the pipeline that we set up earlier will run.



CD In Practice

To create a CD pipeline in Azure Devops, open the Releases menu and press the New button then select new release pipeline.



Then a form will appear to create a new release pipeline, if there is an option to choose a template, select start with an empty job to create a release pipeline from scratch.



First, add the artifact and set the pipeline source by pressing the add button in the Artifacts section. Then, customize the Artifact configuration as needed.



Then, enable the Continuous deployment trigger to run the release pipeline every time there is a successful build of the CI pipeline.



To add release steps, press the add button in the Stages section then select New Stage. Then move to the Tasks tab to set the steps in the release. Here is an example of the steps in the release pipeline:


Once you have done that, press the Save button to save the release pipeline.


Thank you for reading this article about CI/CD. We hope that the information presented can provide a better understanding of the importance of Continuous Integration and Continuous Delivery in software development. By implementing CI/CD practices, development teams can improve efficiency, quality, and speed in releasing software.

For other interesting information about technology and IT, visit: Radya Blog. And for consultation in making applications, you can contact our team at: Radya Contact.


Sumber:

Developing an effective CI/CD pipeline for frontend apps - LogRocket Blog

What is CI/CD? (redhat.com)

What is CI? - Continuous Integration Explained - AWS (amazon.com)

Apa itu Pengiriman Berkelanjutan? – Amazon Web Services


Add Comment