DEV Community

VIJAY MANDA
VIJAY MANDA

Posted on

1

Lets talk about CI/CD Pipeline.

Let's skip the usual What is CI/CD? definitions and dive straight into the core stages. Instead of theory, we'll break down each stage in detail and understand the crucial role DevOps engineers play in the process.
I will try to put it in simple.

Breaking Down CI (Continuous Integration) Stages
CI consists of multiple stages, and while this is just a general example, real-world implementations can vary based on project complexity and company requirements. I'll also share insights on how CI works in real corporate environments at the end

## CI - Continous Integration:
Stage 1: Let’s say a developer writes a Java application. It doesn’t go live immediately because it might have bugs or sensitive information. At this stage, we retrieve the latest version of the code from the repository—this is known as the checkout stage.

Stage 2: Next, the developer’s code is scanned using SonarQube, one of the most widely used tools for code quality and security analysis. While there are many alternatives, SonarQube is preferred for detecting vulnerabilities and bugs, ensuring the code is clean and secure.

Stage 3: In this stage, we use Maven to build the application. This process compiles the code, resolves dependencies, and packages everything into an artifact—a deployable unit like a JAR or WAR file.

Stage 4: Here we package our artifacts into a Docker image, embedding everything needed for deployment inside the Dockerfile.

## Continous Delivery and Continous Deployment.
After the Continuous Integration (CI) process is completed, the workflow transitions into the Continuous Delivery (CD) phase.

At this stage, the application goes through multiple environments before reaching production, including:
Development Environment – Used by developers for early testing and debugging.
Staging Environment – A replica of production where integration, performance, and security testing are conducted.
Pre-Production Environment – The final checkpoint where the application undergoes final validation before going live.

Some companies also incorporate Continuous Deployment within this phase, meaning successful builds automatically get deployed to production without manual intervention.

Important Note: Don't get confused between Continuous Delivery and Continuous Deployment—while they share a similar pipeline, the key difference lies in whether the final deployment requires manual approval or happens automatically.

I'll walk you through an example of a CI/CD Pipeline workflow, but remember that the process can differ depending on the project. This isn't a rigid, fixed workflow.

## Pipeline Workflow.

Once a developer pushes code to GitHub, the CI/CD pipeline is triggered automatically using webhooks or manual triggers by DevOps engineers.
A GitHub Webhook is set up to notify the CI/CD tool (Jenkins, GitHub Actions, GitLab CI, etc.) when code is pushed.
As soon as a new commit or PR is detected, the pipeline starts running.
There are two main ways the pipeline gets triggered:

  • 1. Automatic Trigger (Webhooks)
  • 2. Manual Trigger by DevOps Engineers

Sometimes, DevOps teams trigger the pipeline manually using Jenkins, GitLab, or CLI commands for controlled deployments

Code Quality Check with SonarQube
Once triggered, the first step is usually static code analysis to detect vulnerabilities, bugs, and code smells.

Build the Application & Generate Artifacts (Maven)
Once the code passes the SonarQube check, the next step is building the application using Maven.

Compiles the source code
Packages the application into a JAR/WAR artifact
Stores the artifact in repositories like JFrog Artifactory, Nexus, or S3
After Maven generates the artifact, the next step is containerizing it
with Docker.

Embed the Application into a Docker Image
Creates a Docker image with the built application
Tags the image
Pushes it to a container registry like Docker Hub, AWS ECR, or GCR

Once the Docker image (artifact) is built and pushed to a container
registry like AWS ECR, Docker Hub, the next stages focus on automated
deployment using ArgoCD
to a Kubernetes cluster.

ArgoCD Detects New Image – ArgoCD continuously watches the Git repository for updates in Kubernetes manifests.

ArgoCD Image Updater Updates the Manifest – Instead of manually changing image tags, ArgoCD Image Updater automatically detects the latest image version in the registry and updates the Kubernetes deployment YAML.

ArgoCD Syncs Changes to the Kubernetes Cluster – Once the new image is detected, ArgoCD applies the updated deployment and rolls out the new version in staging or production.

Deployment Strategies – Based on the business needs, deployment can follow Rolling Updates, Canary Releases, or Blue-Green Deployments to ensure a smooth rollout.

Monitoring & Auto-Rollback – Tools like Prometheus, Grafana, and ELK Stack monitor logs and performance. If an issue is detected, ArgoCD can trigger an auto-rollback to restore the last stable version.

*I haven't covered everything in deatil, such as about tools used and its alternatives in deatil, Helm charts, branching strategies, webhooks, pipeline triggers, and artifact storage repositories. So please google it as including all of that in a single thread would be overwhelming. Focus on understanding the basics first, and then gradually dive deeper into the details.
*

Some popular CI/CD Tools in current market.

  1. Jenkins – The most popular open-source automation server.
  2. Azure DevOps – Microsoft’s CI/CD tool with deep Azure integration.
  3. GitHub Actions – Built-in CI/CD for GitHub projects.
  4. GitLab CI/CD – Integrated CI/CD in GitLab.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post