Skip to content

Gauravbhardwajdev/DevSecOps-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

87 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Enterprise DevSecOps CI/CD Pipeline using GitHub Actions, Docker, Kubernetes & AWS EKS

GitHub Actions AWS Docker Kubernetes SonarQube Trivy Checkov


๐Ÿ“Œ Overview

This repository demonstrates an Enterprise DevSecOps CI/CD Pipeline built using GitHub Actions, Docker, Kubernetes, and Amazon EKS.

The goal of this project is to implement a production-inspired DevSecOps workflow by integrating automated security scanning, static code analysis, testing, containerization, image scanning, Software Bill of Materials (SBOM) generation, and Kubernetes deployment.

The pipeline follows Shift Left Security, ensuring security checks are performed throughout the Software Development Lifecycle (SDLC) before deployment.


โœจ Features

  • Automated GitHub Actions CI/CD Pipeline
  • Secret Detection using Gitleaks
  • Infrastructure Security Scanning using Checkov
  • Filesystem Vulnerability Scanning using Trivy
  • Client & Server Linting
  • Automated Unit Testing
  • SonarQube Static Code Analysis
  • SonarQube Quality Gate Validation
  • Multi-stage Docker Build
  • Docker Image Vulnerability Scanning
  • Software Bill of Materials (SBOM) Generation
  • Docker Hub Image Publishing
  • Automatic Kubernetes Manifest Update
  • Kubernetes Deployment to Amazon EKS
  • Deployment Rollout Verification

๐Ÿ— Architecture

graph LR
    A[Developer] -->|Git Push| B[GitHub Repository]
    B --> C[CI/CD Pipeline]
    C --> D[SonarQube SAST]
    C --> E[Trivy Container Scan]
    D --> F{Security Gate Pass?}
    E --> F
    F -->|Yes| G[Docker Hub / ECR]
    G --> H[Kubernetes Deployment]
Loading

๐Ÿ”„ CI/CD Pipeline Flow

Developer Push (QA Branch)
        โ”‚
        โ–ผ
GitHub Actions Trigger
        โ”‚
        โ–ผ
Gitleaks Secret Scan
        โ”‚
        โ–ผ
Checkov Security Scan
 โ”œโ”€โ”€ Terraform
 โ”œโ”€โ”€ Kubernetes
 โ””โ”€โ”€ Docker
        โ”‚
        โ–ผ
Trivy Filesystem Scan
 โ”œโ”€โ”€ Client
 โ””โ”€โ”€ Server
        โ”‚
        โ–ผ
Client & Server Lint
        โ”‚
        โ–ผ
Client & Server Tests
        โ”‚
        โ–ผ
SonarQube Analysis
        โ”‚
        โ–ผ
Client Build
        โ”‚
        โ–ผ
Multi-stage Docker Build
        โ”‚
        โ–ผ
Trivy Image Scan
        โ”‚
        โ–ผ
SBOM Generation
        โ”‚
        โ–ผ
Push Docker Image
        โ”‚
        โ–ผ
Update Kubernetes Manifest
        โ”‚
        โ–ผ
Deploy to Amazon EKS
        โ”‚
        โ–ผ
Verify Deployment

๐Ÿ“ท GitHub Actions Pipeline

The complete CI/CD workflow is implemented using GitHub Actions.

GitHub Actions Pipeline


๐ŸŒฟ Branch Strategy

This project follows a simple environment-based branching strategy.

Branch Purpose
main Production Environment
qa QA / Staging Environment

QA Pipeline

The QA pipeline performs:

  • Secret Scanning
  • Security Validation
  • Linting
  • Unit Testing
  • SonarQube Analysis
  • Docker Build
  • Docker Image Scan
  • SBOM Generation
  • Docker Image Push
  • Kubernetes Deployment to QA Cluster

Production Workflow

A separate production deployment workflow is included for production releases after QA validation.


๐Ÿ” Security Pipeline

1. Gitleaks

Scans the Git repository for accidentally committed:

  • Secrets
  • API Keys
  • Tokens
  • Passwords
  • AWS Credentials

2. Checkov

Infrastructure as Code (IaC) security scanning for:

  • Terraform
  • Kubernetes Manifests
  • Dockerfile

3. Trivy Filesystem Scan

Scans the client and server source code for:

  • Vulnerabilities
  • Misconfigurations
  • Security Issues

4. Linting

Runs linting on both client and server applications.


5. Automated Testing

Runs application test cases before deployment.


6. SonarQube

Performs:

  • Static Code Analysis
  • Bugs Detection
  • Code Smells
  • Security Hotspots
  • Maintainability Analysis

The Quality Gate validates the project before continuing.


7. Docker Build

A secure multi-stage Docker build is used to produce a lightweight production image.

Security best practices include:

  • Multi-stage Build
  • Alpine Images
  • Production Dependencies Only
  • Non-root User
  • Reduced Attack Surface

8. Trivy Image Scan

The generated Docker image is scanned before publishing.

Checks include:

  • Critical Vulnerabilities
  • High Vulnerabilities

9. Software Bill of Materials (SBOM)

SBOM files are generated for:

  • Source Code
  • Docker Image

This improves software supply chain transparency.


10. Docker Hub

Images are published using:

  • Commit SHA Tag
  • Latest Tag

11. Kubernetes Manifest Update

The deployment manifest is automatically updated with the latest Docker image tag before deployment.


12. Amazon EKS Deployment

The application is deployed using:

  • GitHub OIDC Authentication
  • AWS IAM Role
  • kubectl
  • Kubernetes Manifests

Deployment verification is automatically performed after rollout.


๐Ÿณ Docker

This project uses a multi-stage Docker build.

Highlights:

  • Frontend Build Stage
  • Backend Runtime Stage
  • Production Dependencies
  • Non-root User
  • Lightweight Alpine Images
  • Optimized Image Size

โ˜ธ Kubernetes

Deployment uses the following Kubernetes resources.

  • Deployment
  • Service
  • Ingress

Separate manifests are maintained for:

  • QA
  • Production

๐Ÿ“‚ Repository Structure

.
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ”œโ”€โ”€ qa-cicd.yml
โ”‚       โ””โ”€โ”€ prod-cd.yaml
โ”‚
โ”œโ”€โ”€ client/
โ”‚
โ”œโ”€โ”€ server/
โ”‚
โ”œโ”€โ”€ k8-manifests/
โ”‚   โ”œโ”€โ”€ qa/
โ”‚   โ”‚   โ”œโ”€โ”€ app-deployment.yaml
โ”‚   โ”‚   โ”œโ”€โ”€ app-svc.yaml
โ”‚   โ”‚   โ””โ”€โ”€ app-ingress.yaml
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ prod/
โ”‚       โ”œโ”€โ”€ app-deployment.yaml
โ”‚       โ”œโ”€โ”€ app-svc.yaml
โ”‚       โ””โ”€โ”€ app-ingress.yaml
โ”‚
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ architecture.png
โ”‚   โ””โ”€โ”€ screenshots/
โ”‚       โ”œโ”€โ”€ github-actions-pipeline.png
โ”‚       โ”œโ”€โ”€ sonarqube-dashboard.png
โ”‚       โ”œโ”€โ”€ trivy-report.png
โ”‚       โ””โ”€โ”€ deployment.png
โ”‚
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ sonar-project.properties
โ”œโ”€โ”€ .gitignore
โ””โ”€โ”€ README.md

๐Ÿ“ธ Screenshots

GitHub Actions

GitHub Actions


SonarQube Dashboard

SonarQube


Trivy Scan

Trivy


Kubernetes Deployment

Deployment


๐Ÿšง Current Status

This project was successfully developed and tested as an end-to-end DevSecOps learning project.

The AWS learner account originally used to host the Amazon EKS cluster and related cloud resources has since expired after the available credits were exhausted. As a result, the deployment stage cannot currently be demonstrated.

The repository still contains the complete implementation of:

  • GitHub Actions workflows
  • Docker configuration
  • Kubernetes manifests
  • Security scanning
  • CI/CD automation
  • Deployment logic

๐Ÿ”ฎ Future Improvements

  • Helm Charts
  • ArgoCD GitOps Deployment
  • Prometheus Monitoring
  • Grafana Dashboards
  • Horizontal Pod Autoscaler
  • Slack Notifications
  • Canary Deployment
  • Blue/Green Deployment
  • Terraform Infrastructure Provisioning

๐Ÿ‘จโ€๐Ÿ’ป Author

Gaurav Bhardwaj

DevOps & Cloud Engineer

๐Ÿ“ง Email: gaurav.bhardwaj4@hotmail.com

๐Ÿ”— LinkedIn: https://www.linkedin.com/in/YOUR-LINKEDIN

๐Ÿ’ป GitHub: https://github.com/Gauravbhardwajdev


โญ Support

If you found this project useful, consider giving it a โญ on GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages