π DevOps Week 9.1 β Complete CI/CD Journey with Jenkins & GitHub Actions
Master the foundations of CI/CD, learn Jenkins from Zero to Hero, build real-world pipelines with Docker & Kubernetes, and automate software delivery using GitHub Actions and Self-Hosted Runners.

π Introduction to CI/CD π
π Why Modern Software Needs CI/CD
Imagine a company with hundreds of developers working on the same application. Every day, new features, bug fixes, and security updates are added. If all these changes were tested and deployed manually, software releases would take weeks or even months.
CI/CD solves this problem by automating the software delivery process, allowing teams to release applications faster, safer, and more reliably.
πΉ What is CI/CD? π€
CI/CD stands for:
Continuous Integration (CI)
Continuous Integration is the practice of frequently merging code changes into a shared repository. Every time code is pushed, automated processes build and test the application to ensure everything works correctly.
Continuous Delivery (CD)
Continuous Delivery is the process of automatically preparing tested code for deployment. It ensures applications can be released quickly and consistently across different environments.
Together, CI/CD helps organizations deliver software faster while maintaining quality and security.
πΉ Traditional Software Delivery vs CI/CD βοΈ
Without CI/CD
β Manual testing
β Manual deployments
β Slow release cycles
β Higher chances of human errors
β Difficult troubleshooting
With CI/CD
β Automated testing
β Faster deployments
β Better software quality
β Early bug detection
β Improved team productivity
πΉ How CI/CD Works? βοΈ
A typical CI/CD workflow looks like this:
Developer Writes Code
β
Pushes Code to GitHub
β
CI/CD Tool Detects Changes
β
Application Build Starts
β
Automated Tests Run
β
Security & Quality Checks
β
Deploy to Development Environment
β
Deploy to Staging Environment
β
Deploy to Production Environment
This entire process can happen automatically whenever code changes are pushed.
πΉ Key Stages of a CI/CD Pipeline π
Code Commit
Developers write code and push changes to a Git repository such as GitHub.
Build Stage
The application is compiled or packaged into a deployable artifact.
Examples:
Java β JAR File
Node.js β Build Package
Docker β Docker Image
Automated Testing
Different tests are executed automatically:
Unit Testing
Integration Testing
Functional Testing
End-to-End Testing
Security & Quality Checks
Tools scan the application for:
Bugs
Vulnerabilities
Coding issues
Deployment
After successful validation, the application is deployed automatically to the target environment.
πΉ Understanding Deployment Environments π
Development Environment (Dev)
Used by developers to test new features quickly.
Staging Environment
A production-like environment used for final validation before release.
Production Environment
The live environment where real users access the application.
πΉ Popular CI/CD Tools π οΈ
Jenkins
One of the most widely used CI/CD tools with a large plugin ecosystem.
GitHub Actions
A modern CI/CD solution built directly into GitHub.
GitLab CI/CD
Integrated CI/CD platform provided by GitLab.
Azure DevOps
Microsoft's complete DevOps platform for building and deploying applications.
πΉ Legacy CI/CD vs Modern CI/CD βοΈ
Legacy Approach
Earlier, organizations relied on dedicated virtual machines to run Jenkins servers.
Challenges:
Expensive infrastructure
Difficult scaling
High maintenance effort
Modern Approach
Platforms like GitHub Actions use temporary containers or runners that start only when needed.
Benefits:
Lower costs
Better scalability
Faster execution
Reduced operational overhead
πΉ Real-World Example π‘
Consider an e-commerce application.
A developer adds a new payment feature and pushes the code to GitHub.
The CI/CD pipeline automatically:
Builds the application
Runs tests
Performs security scans
Creates deployment packages
Deploys the update
Within minutes, the feature is available without requiring manual intervention.
πΉ Benefits of CI/CD for DevOps Engineers π
β Faster software releases
β Improved code quality
β Reduced deployment failures
β Better collaboration between teams
β Automated testing and validation
β Consistent deployment process
β Enhanced customer experience
π Jenkins Zero to Hero | Complete Beginner Guide to CI/CD, Docker Agents, Kubernetes & GitOps
π Introduction
Jenkins is one of the most popular automation tools used by DevOps Engineers for implementing Continuous Integration (CI) and Continuous Delivery (CI/CD).
In modern software development, manually building, testing, and deploying applications is time-consuming and error-prone. Jenkins automates these tasks and helps teams deliver software faster and more reliably.
In this blog, we will learn:
β What Jenkins is
β Why Jenkins is important
β Jenkins Architecture
β Installing Jenkins on AWS EC2
β Docker as Jenkins Agents
β Jenkins Pipelines
β Multi-Stage CI/CD Pipelines
β Jenkins + Kubernetes + ArgoCD Workflow
β Real-World DevOps Use Cases
β Common Jenkins Interview Questions
π Why Jenkins is Important?
Imagine a development team where developers push code multiple times every day.
Without automation:
Developers write code
QA tests manually
Operations team deploys manually
This process is slow and prone to mistakes.
Jenkins automates:
Building code
Running tests
Creating artifacts
Deploying applications
This enables faster and more reliable software delivery.
π€ What is Jenkins?
Jenkins is an open-source automation server used for CI/CD.
Its main purpose is to automate software delivery pipelines.
Jenkins can:
Pull code from GitHub
Build applications
Run tests
Create Docker images
Deploy applications
Monitor delivery workflows
Think of Jenkins as a central automation engine that connects development and operations teams.
π What is CI/CD?
Continuous Integration (CI)
Developers frequently merge code into a shared repository.
Whenever code is pushed:
Build starts automatically
Tests run automatically
Issues are detected early
Continuous Delivery (CD)
After successful testing:
Applications are prepared for deployment
Releases become faster and safer
Continuous Deployment
Every successful change is automatically deployed to production without manual intervention.
π Jenkins Architecture
Jenkins works using a Controller-Agent architecture.
Jenkins Controller
The controller is the brain of Jenkins.
Responsibilities:
Manage pipelines
Schedule jobs
Store configurations
Monitor builds
Jenkins Agents
Agents execute the actual work.
Examples:
Build code
Run tests
Create Docker images
Deploy applications
Instead of running everything on one machine, Jenkins distributes workloads across agents.
βοΈ Installing Jenkins on AWS EC2
A common industry practice is to install Jenkins on an Ubuntu EC2 instance.
Basic Steps
Create:
AWS EC2 Instance
Security Groups
SSH Access
Install:
sudo apt update
sudo apt install openjdk-17-jdk
Add Jenkins Repository:
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
Install Jenkins:
sudo apt install jenkins
Start Service:
sudo systemctl start jenkins
Check Status:
sudo systemctl status jenkins
Access Jenkins:
http://<EC2-Public-IP>:8080
π Initial Jenkins Setup
After installation:
Unlock Jenkins
Retrieve Admin Password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Install Suggested Plugins
Jenkins automatically recommends essential plugins.
Examples:
Git Plugin
Pipeline Plugin
Docker Plugin
Kubernetes Plugin
π³ Why Use Docker as Jenkins Agents?
Traditionally, Jenkins agents were Virtual Machines.
This approach creates challenges:
β Expensive
β Slow startup
β Difficult dependency management
β Resource wastage
Docker solves these issues.
Benefits of Docker Agents
β Lightweight
β Fast Startup
β Better Isolation
β Easy Dependency Management
β Lower Infrastructure Costs
βοΈ Jenkins + Docker Workflow
Developer Pushes Code β Jenkins Triggered β Docker Agent Created β Build Executed β Tests Executed β Docker Agent Destroyed
Every build gets a fresh environment.
This ensures consistency across pipelines.
π§± What is a Jenkins Pipeline?
A pipeline defines the entire CI/CD workflow as code.
Instead of clicking buttons in Jenkins UI, pipelines are written using Groovy syntax.
Benefits:
Version Controlled
Reusable
Easy to Maintain
Infrastructure as Code Approach
π Declarative Pipeline Example
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building Application'
}
}
stage('Test') {
steps {
echo 'Running Tests'
}
}
stage('Deploy') {
steps {
echo 'Deploying Application'
}
}
}
}
π Key Stages in CI/CD Pipeline
Source Stage
Pull source code from GitHub.
Build Stage
Compile application code.
Test Stage
Execute automated tests.
Package Stage
Create Docker images or build artifacts.
Security Scan Stage
Perform:
Vulnerability Scanning
Dependency Checks
Code Analysis
Deploy Stage
Deploy application to:
Development
Staging
Production
π’ Real-World Multi-Stage Pipeline
For enterprise applications:
Stage 1 β Checkout Code
Stage 2 β Build
Stage 3 β Unit Testing
Stage 4 β Security Scan
Stage 5 β Docker Image Creation
Stage 6 β Push Image to Registry
Stage 7 β Kubernetes Deployment
βΈοΈ Jenkins + Kubernetes Integration
Modern organizations deploy applications on Kubernetes.
Jenkins helps automate deployments.
Workflow:
Developer β GitHub β Jenkins Pipeline β Docker Image β Container Registry β Kubernetes Cluster
π Jenkins + GitOps + ArgoCD
Modern DevOps teams increasingly use GitOps.
Instead of Jenkins directly deploying applications:
Jenkins updates deployment manifests in Git.
ArgoCD watches Git repositories.
Whenever changes occur:
ArgoCD automatically syncs them to Kubernetes.
GitOps Workflow
Developer Pushes Code β Jenkins Builds Application β Docker Image Created β Manifest Updated β Git Repository Updated β ArgoCD Detects Change β Kubernetes Updated Automatically
π Why GitOps is Better?
Benefits:
β Version Control
β Easy Rollback
β Audit Trail
β Declarative Infrastructure
β Improved Security
π’ Real-Life Example
Suppose an E-Commerce Company deploys:
Frontend Service
Backend Service
Payment Service
Whenever developers push changes:
Jenkins:
Builds Docker Images
Runs Tests
Updates Kubernetes Manifests
ArgoCD:
Detects Changes
Deploys Automatically
Customers receive updates without downtime.
π― Common Jenkins Interview Questions
What is Jenkins?
Jenkins is an open-source automation server used to implement CI/CD pipelines.
What is the Difference Between CI and CD?
CI focuses on integrating and testing code continuously.
CD focuses on delivering and deploying applications continuously.
Why Use Docker Agents in Jenkins?
Docker agents provide:
Isolation
Faster execution
Consistent environments
Lower infrastructure costs
What is Jenkins Pipeline?
A Jenkins Pipeline is a series of automated steps defined as code to build, test, and deploy applications.
What is Jenkinsfile?
A Jenkinsfile contains pipeline definitions written in Groovy.
It is stored inside the source code repository.
What is GitOps?
GitOps is a deployment strategy where Git acts as the source of truth and tools like ArgoCD automatically synchronize infrastructure and applications.
How Would You Troubleshoot a Failed Jenkins Build?
Steps:
Check Console Logs
Verify Agent Status
Check Git Access
Verify Dependencies
Review Pipeline Configuration
π₯ Best Practices
β Use Pipelines as Code
β Store Jenkinsfiles in Git
β Use Docker Agents
β Implement Security Scanning
β Integrate with Kubernetes
β Follow GitOps Principles
β Use Role-Based Access Control (RBAC)
β Regularly Backup Jenkins Configuration
π GitHub Actions Complete Guide | GitHub Actions vs Jenkins | CI/CD Projects & Self-Hosted Runners
π Introduction
Modern software development requires fast, reliable, and automated delivery of applications. Manually building, testing, and deploying code is slow, error-prone, and difficult to scale.
This is where GitHub Actions comes in.
GitHub Actions is GitHub's built-in CI/CD platform that allows developers to automate workflows directly inside their GitHub repositories.
In this blog, we will learn:
β What GitHub Actions is
β Why GitHub Actions is Popular
β How GitHub Actions Works
β Workflow Structure
β GitHub Hosted vs Self-Hosted Runners
β Real CI/CD Projects
β Managing Secrets
β GitHub Actions vs Jenkins
β Interview Questions
β Real-World DevOps Use Cases
π Why Modern Software Needs CI/CD?
Imagine a team of developers pushing code multiple times every day.
Without automation:
Developers write code
Manual testing starts
Operations teams deploy manually
Bugs reach production
Releases become slow
As applications grow, manual deployments become impossible to manage.
CI/CD solves this problem by automating:
Building applications
Running tests
Security checks
Deployments
Result:
β Faster Releases
β Better Quality
β Reduced Human Errors
β Higher Productivity
π€ What is GitHub Actions?
GitHub Actions is a CI/CD and automation platform built directly into GitHub.
It allows developers to automate workflows whenever specific events occur.
Examples:
Code Push
Pull Request Creation
Release Creation
Scheduled Tasks
GitHub Actions automatically executes workflows based on these events.
Think of GitHub Actions as a personal DevOps engineer inside your GitHub repository.
π Why GitHub Actions is Popular?
GitHub Actions has become extremely popular because it is simple and fully integrated with GitHub.
Benefits include:
β No Separate Server Required
β Easy YAML Configuration
β Built-in GitHub Integration
β Large Marketplace of Actions
β Free for Public Repositories
β Supports Multiple Programming Languages
β Easy Kubernetes & Cloud Integrations
βοΈ How GitHub Actions Works?
GitHub Actions follows an event-driven approach.
Workflow:
Developer Pushes Code β GitHub Detects Event β Workflow Triggered β Runner Executes Tasks β Build & Test Application β Deploy Application
Everything happens automatically.
π Core Components of GitHub Actions
Workflow
A workflow is an automated process.
Workflows are stored inside:
.github/workflows/
Example:
.github/workflows/ci.yml
Events
Events trigger workflows.
Common events:
on:
push:
on:
pull_request:
on:
workflow_dispatch:
Examples:
Push Code
Create Pull Request
Schedule Jobs
Manual Trigger
Jobs
A workflow contains one or more jobs.
Example:
Build Job
Test Job
Deploy Job
Each job runs independently.
Steps
Each job contains multiple steps.
Example:
Checkout Code
Install Dependencies
Run Tests
Build Application
Actions
Actions are reusable automation components.
Popular Actions:
Checkout Repository
uses: actions/checkout@v4
Setup Python
uses: actions/setup-python@v5
These actions save time and simplify workflow creation.
π Basic Workflow Structure
Example:
name: Python CI
on:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install -r requirements.txt
- run: pytest
Workflow Explanation:
Trigger on code push
Create Ubuntu Runner
Checkout Repository
Install Python
Install Dependencies
Run Tests
π Project 1: Python Application Testing
Goal:
Automatically run unit tests whenever code is pushed.
Workflow:
Developer Push β GitHub Actions Triggered β Install Python β Install Dependencies β Run PyTest β Display Results
Benefits:
β Early Bug Detection
β Faster Development
β Consistent Testing
π³ Project 2: Build Docker Images Automatically
Workflow:
Developer Push β GitHub Actions β Build Docker Image β Push Image to Docker Hub
Example Steps:
docker build
docker push
Benefits:
β Automated Image Creation
β Faster Releases
β Consistent Builds
βΈοΈ Project 3: Kubernetes Deployment
Workflow:
Developer Push β GitHub Actions β Build Docker Image β Push to Registry β Update Kubernetes Manifest β Deploy Application
Benefits:
β Automated Deployment
β GitOps-Friendly Workflow
β Reduced Manual Work
π Managing Secrets in GitHub Actions
Applications often require sensitive information.
Examples:
API Keys
Database Passwords
Kubernetes Config Files
Cloud Credentials
Never store secrets inside code repositories.
Instead use:
GitHub Repository β Settings β Secrets and Variables β Actions
Examples of Secrets
DOCKER_USERNAME
DOCKER_PASSWORD
KUBECONFIG
AWS_ACCESS_KEY
π₯ What is a Runner?
A Runner is the machine that executes workflows.
When GitHub Actions starts:
A Runner performs:
Build
Test
Deploy
operations.
βοΈ GitHub Hosted Runners
GitHub provides managed runners.
Examples:
runs-on: ubuntu-latest
runs-on: windows-latest
runs-on: macos-latest
Advantages:
β No Infrastructure Management
β Fast Setup
β Automatically Updated
π’ What is a Self-Hosted Runner?
A Self-Hosted Runner is a machine managed by your organization.
Examples:
EC2 Instance
Physical Server
Kubernetes Node
GitHub sends jobs to your machine.
π Why Use Self-Hosted Runners?
Use cases:
High Compute Requirements
Machine Learning Projects
Large Builds
Big Data Workloads
Private Network Access
Internal Databases
Private APIs
On-Prem Applications
Cost Optimization
Reduce usage of GitHub-hosted runners.
βοΈ How to Configure a Self-Hosted Runner?
Steps:
GitHub Repository β Settings β Actions β Runners β New Self Hosted Runner
GitHub provides commands:
mkdir actions-runner
./config.sh
./run.sh
After setup, workflows can use:
runs-on: self-hosted
βοΈ GitHub Actions vs Jenkins
| Feature | GitHub Actions | Jenkins |
|---|---|---|
| Hosting | Managed by GitHub | Self Managed |
| Maintenance | Minimal | High |
| Infrastructure | Not Required | Required |
| Setup Complexity | Easy | Medium to High |
| GitHub Integration | Native | Plugin Based |
| Cost | Cost Effective | Infrastructure Cost |
| Plugins | Marketplace Actions | Jenkins Plugins |
| Learning Curve | Easier | Steeper |
π When to Choose GitHub Actions?
Use GitHub Actions when:
β Organization Uses GitHub
β Want Faster Setup
β Want Less Maintenance
β Need Modern CI/CD
β Prefer Managed Infrastructure
π’ When to Choose Jenkins?
Use Jenkins when:
β Multi-VCS Support Required
β Vendor Independence Needed
β Complex Enterprise Workflows
β Advanced Customization Required
π‘ Real-World Example
Suppose a company hosts applications on Kubernetes.
Whenever developers push code:
GitHub Actions:
Runs Tests
Builds Docker Image
Pushes Image to Registry
Updates Deployment Files
ArgoCD:
Detects Changes
Deploys Automatically
Result:
Fully Automated GitOps Pipeline
π― Common Interview Questions
What is GitHub Actions?
GitHub Actions is GitHub's built-in CI/CD platform used to automate software development workflows.
Where are workflows stored?
Inside:
.github/workflows/
What is a Runner?
A runner is a machine that executes GitHub Actions workflows.
What is a Self-Hosted Runner?
A self-hosted runner is a machine managed by the organization that executes GitHub Actions jobs.
How are secrets managed?
Using:
Repository Settings β Secrets and Variables β Actions
GitHub Actions vs Jenkins?
GitHub Actions is easier and fully integrated with GitHub.
Jenkins provides greater flexibility and customization.
π₯ Best Practices
β Store Workflows in Git
β Use Secrets Instead of Hardcoding Credentials
β Keep Workflows Modular
β Use Reusable Actions
β Automate Testing
β Automate Security Scanning
β Follow GitOps Principles
β Monitor Workflow Failures
π Continue Your Learning Journey
Thank you for taking the time to read this article.
Technology is evolving rapidly, and continuous learning is one of the most valuable investments you can make in your career. Whether you're exploring DevOps, Cloud Computing, Artificial Intelligence, Cybersecurity, Software Development, Data Science, or Career Growth, the resources below can help you deepen your knowledge and stay ahead in the industry.
π Recommended Learning Platforms
π Coursera
Learn from world-renowned universities and industry leaders including Google, IBM, Stanford, Microsoft, Meta, and many more.
β Professional Certificates β Career-focused Learning Paths β AI & Machine Learning Programs β Cloud & DevOps Certifications β Business & Leadership Courses
π https://imp.i384100.net/k0KvbV
π» Udemy
One of the largest online learning platforms with practical, hands-on courses covering:
β DevOps & Kubernetes β Docker & Cloud Computing β AWS, Azure & GCP β Programming & Development β Cybersecurity & Ethical Hacking
π https://trk.udemy.com/MAL2MY
π DataCamp
A great platform for anyone interested in:
β Python Programming β SQL & Databases β Data Analytics β Machine Learning β Artificial Intelligence
Interactive learning paths and hands-on projects make it ideal for beginners and professionals alike.
π https://datacamp.pxf.io/nX4kER
π edX
Access high-quality courses and certifications from leading institutions such as:
β Harvard University β MIT β Berkeley β Microsoft
Perfect for learners seeking university-level education online.
π https://edx.sjv.io/POvVeN
π¨ Domestika
Enhance your creative skills with courses on:
β Graphic Design β Video Editing β Animation β Digital Marketing β Content Creation
π https://domestika.sjv.io/dynKAW
π οΈ Recommended Tools & Resources
π₯ AppSumo
Discover exclusive lifetime deals on:
β AI Tools β Productivity Software β Developer Utilities β Marketing Platforms β Business Applications
A must-have resource for developers, creators, freelancers, and entrepreneurs looking to save money while accessing premium tools.
π https://appsumo.8odi.net/L04a33
π Shopify
Looking to start an online business or launch an eCommerce store?
Shopify provides everything you need to build, manage, and scale an online business.
β Online Store Builder β Payment Integration β Inventory Management β Marketing Tools
π https://shopify.pxf.io/Vxv09k
π WordPress, WooCommerce & Jetpack
Create professional websites, blogs, and online stores with one of the most trusted web ecosystems in the world.
Ideal for:
β Personal Blogs β Portfolio Websites β Business Websites β eCommerce Stores
π https://automattic.pxf.io/Z6vR5W
π Language Learning Resources
π£οΈ Preply
Learn English and other languages through personalized one-on-one tutoring sessions with experts from around the world.
π https://preply.sjv.io/o4gBDY
π British Council English Online
Improve your professional communication skills and English fluency through structured learning programs.
π https://englishonline.sjv.io/9VOGa4
π§ Rosetta Stone
One of the most recognized language-learning platforms for immersive language acquisition.
π https://aff.rosettastone.com/X4OyqG
π§ͺ Science & Educational Resources
π¬ MEL Science
Interactive science kits and educational experiences designed to make STEM learning engaging and practical.
π https://imp.i328067.net/bk2beg
π Carson Dellosa Education
Educational materials and learning resources for students, teachers, and lifelong learners.
π https://carsondellosaeducation.sjv.io/E0JbjW
β€οΈ Support My Work
Creating detailed technical content, tutorials, guides, and learning resources takes significant time and effort.
If you find my articles helpful and would like to support my work, you can do so through the following platforms:
β Become a GitHub Sponsor
Support my open-source contributions, technical content, and community projects.
π https://github.com/sponsors/hritikranjan1
β Buy Me a Chai
Enjoying my content? Consider buying me a chai and supporting future tutorials, guides, and educational resources.
π https://www.chai4.me/hritikranjan
π¨βπ» Connect With Me
Hritik Ranjan
π‘ AI Enthusiast βοΈ DevOps Learner π Cybersecurity Advocate π» Software Developer
Connect & Follow
π GitHub: https://github.com/hritikranjan1
π LinkedIn: https://linkedin.com/in/hritikranjan1
π’ Found This Article Helpful?
If this article added value to your learning journey:
β
Share it with your network
β
Bookmark it for future reference
β
Follow for more DevOps, AI, Cloud, Cybersecurity, and Software Engineering content
Thank you for reading and being part of this learning journey.
Keep Learning. Keep Building. Keep Growing. π





