How hustlerx01/automated-security-pipeline-devsecops works
Project Type & Purpose
• This is a DevSecOps CI/CD pipeline repository embedding:
• A Spring Boot microservice (DemoApplication) built with Maven
• A Jenkins declarative Pipeline (Jenkinsfile + vars/helloWorld.groovy)
• Infrastructure manifests (Dockerfile, spring-boot-deployment.yaml)
• Documentation and setup scripts for Jenkins, SonarQube, Vault, Docker, Trivy, AWS S3, Kubernetes (Minikube), and Slack.
• Purpose: Automate code build, test, static analysis, containerization, vulnerability scanning, artifact publishing, deployment to Kubernetes, and notifications—while enforcing security best practices.
File Structure
• src/main/java/com/example/demo → Spring Boot application
• pom.xml & .mvn/ → Maven build config
• Jenkinsfile & vars/helloWorld.groovy → CI/CD pipeline definition & shared library
• Dockerfile → container image build
• spring-boot-deployment.yaml → Kubernetes Deployment & Service
• Other top-level: SonarQube, Vault, Slack, AWS integration scripts
Extract Key Architectural Insights from README
• Pipeline stages: Checkout → Build/Test (Maven/JUnit) → SonarQube scan & quality gate → Docker build → Trivy image scan → Push reports to AWS S3 → Push image to Docker Hub → Deploy to Kubernetes → Notify Slack
• External systems: GitHub (source), SonarQube server, Vault (secret store), AWS S3, Docker Hub, Kubernetes cluster (Minikube), Slack workspace
• Credentials managed via Jenkins credentials store & Vault AppRole
Main Components & Their Relationships
a. Source Control
• GitHub repo holds code, pipeline, infra-as-code
↓ triggers
b. CI/CD Orchestrator
• Jenkins master (with pipeline script, plugins, credentials)
1) Checks out code
2) Invokes Maven for compile & JUnit tests
3) Calls SonarQube scanner → SonarQube server → Quality Gate webhook back to Jenkins
4) Builds Docker image (Docker daemon)
5) Runs Trivy container scanner
6) Uses AWS CLI to upload the Trivy HTML report to S3
7) Logs into Docker Hub → pushes images
8) Applies Kubernetes manifests via kubernetesDeploy plugin (using kubeconfig credentials)
9) Notifies Slack via slackSend
c. Static Analysis & Quality
• SonarQube server & database (Postgres)
d. Secrets Management
• Hashicorp Vault (AppRole) → supplies Docker Hub, AWS, SonarQube, Slack secrets to Jenkins
e. Artifact Stores
• AWS S3 (reports), Docker Hub (images)
f. Runtime Environment
• Kubernetes cluster (Minikube) running the Spring Boot service
g. Notifications
• Slack channel reporting build/deploy status
Architectural Patterns & Design Principles
• “Pipeline as Code” in Jenkinsfile for reproducibility
• Immutable artifact promotion: container built once, scanned, then deployed
• Separation of concerns: build/test/scan/deploy stages
• Secrets externalized in Vault, retrieved at runtime
• Single‐responsibility microservice (Spring Boot) behind Kubernetes Service
• Observability via SonarQube dashboards, S3‐hosted Trivy reports, and Slack notifications
Detailed Element Checklist
• Source Control (GitHub)
• CI/CD Orchestrator (Jenkins + Shared Library)
• Build Tool & Tests (Maven, JUnit)
• Static Analysis (SonarQube + Quality Gate)
• Containerization (Dockerfile, Docker daemon)
• Vulnerability Scanner (Trivy)
• Artifact & Report Stores (AWS S3, Docker Hub)
• Secret Management (Hashicorp Vault)
• Container Orchestration (Kubernetes cluster)
• Notification Channel (Slack)
• Credentials & Configs (Jenkins Credentials, Vault AppRole, kubeconfig)
• Interactions: who calls whom, where data/files flow, where secrets are fetched