Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

69 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ DevSecOps Platform with GitOps

A production-oriented DevSecOps platform demonstrating how multiple applications can be built, secured, and deployed through different CI platforms while sharing a centralized GitOps-based Continuous Delivery layer on Kubernetes.

Kubernetes Jenkins GitLab CI ArgoCD SonarQube Kaniko Docker Nexus Syft Grype OWASP ZAP Trivy Gitleaks


πŸ“Œ Platform Overview

This platform delivers two independent applications through two different CI platforms, both converging on a single centralized GitOps deployment layer managed by Argo CD.

Application Source Control CI Platform Security Tools
Spring Boot GitHub Jenkins SonarQube, Syft, Grype, OWASP ZAP
Bootstrap 5 GitLab GitLab CI Trivy, Gitleaks, Hadolint, CycloneDX

Both pipelines update a shared GitOps repository. Argo CD watches the repository and deploys automatically β€” neither pipeline ever runs kubectl directly.


πŸ—οΈ Architecture

                         DEVELOPERS
                              β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                               β”‚
              β–Ό                               β–Ό
           GitHub                           GitLab
     (Spring Boot App)                (Bootstrap App)
              β”‚                               β”‚
              β–Ό                               β–Ό
          Jenkins                          GitLab CI
       Kubernetes Agents               Kubernetes Runner
              β”‚                               β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚ SonarQube       β”‚             β”‚ Hadolint          β”‚
     β”‚ Maven + Nexus   β”‚             β”‚ Kaniko Build      β”‚
     β”‚ Kaniko Build    β”‚             β”‚ Trivy Image Scan  β”‚
     β”‚ Syft + Grype    β”‚             β”‚ Trivy Config Scan β”‚
     β”‚ GitOps Update   β”‚             β”‚ Gitleaks          β”‚
     β”‚ OWASP ZAP       β”‚             β”‚ CycloneDX SBOM    β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚                               β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
                   GitOps Manifests Repository
                    (Single Source of Truth)
                              β”‚
                              β–Ό
                           Argo CD
                         App of Apps
                              β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β–Ό                         β–Ό
         spring-boot-app             bootstrap-app
                 β”‚                         β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
                     Kubernetes Cluster
                        namespace: apps

πŸ”— Related Repositories

Repository Purpose Link
devsecops-gitops-platform Platform infrastructure + Spring Boot CI GitHub
bootstrap-devops-app Bootstrap application + GitLab CI pipeline GitLab
gitops-manifests Centralized GitOps manifests (SSOT) GitHub

πŸ”„ CI/CD Flow

1. Developer pushes code
         β”‚
         β–Ό
2. CI pipeline triggers (Jenkins or GitLab CI)
         β”‚
         β–Ό
3. Build β†’ Security Scan β†’ Image Push to Docker Hub
         β”‚
         β–Ό
4. Update image tag in GitOps manifests repository
         β”‚
         β–Ό
5. Argo CD detects the Git change
         β”‚
         β–Ό
6. Argo CD syncs β†’ Kubernetes deploys the new version
         β”‚
         β–Ό
7. (Jenkins only) OWASP ZAP scans the live application

No CI pipeline ever runs kubectl apply or deploys directly to Kubernetes. Git is the only deployment trigger. Argo CD is the only deployer.


πŸ” Security Layers

Layer Tool Spring Boot Bootstrap
Code Quality SonarQube βœ… β€”
Dockerfile Lint Hadolint β€” βœ…
Secret Detection Gitleaks β€” βœ…
Rootless Image Build Kaniko βœ… βœ…
SBOM Generation Syft / CycloneDX βœ… βœ…
CVE Scanning Grype / Trivy βœ… βœ…
IaC Scanning Trivy Config β€” βœ…
Runtime DAST OWASP ZAP βœ… β€”

πŸ—οΈ Infrastructure

All components run on a Kubernetes (Kind) cluster.

Component Namespace Installed Via
Jenkins jenkins Helm
SonarQube sonarqube Helm
Nexus Repository nexus Helm
Argo CD argocd Kustomize
GitLab Runner gitlab-runner Helm
Spring Boot App apps Argo CD (GitOps)
Bootstrap App apps Argo CD (GitOps)

πŸ“‚ Repository Structure

devsecops-gitops-platform/            ← This repository
β”œβ”€β”€ spring-boot-app/                  ← Spring Boot source code
β”‚   β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ pom.xml
β”‚   └── Dockerfile
β”œβ”€β”€ helm-values/                      ← Helm values (Jenkins, SonarQube, Nexus)
β”‚   β”œβ”€β”€ jenkins-values.yaml
β”‚   β”œβ”€β”€ sonarqube-values.yaml
β”‚   └── nexus-values.yml
β”œβ”€β”€ kustomize-manifests/              ← Kustomize (Argo CD install)
β”‚   └── argocd/
β”‚       └── kustomization.yaml
β”œβ”€β”€ Jenkinsfile                       ← Jenkins CI pipeline
β”œβ”€β”€ syft-grype.Dockerfile             ← Custom Syft + Grype image
β”œβ”€β”€ jenkins-rbac.yaml                 ← Jenkins RBAC
└── README.md

πŸš€ Setup Guide

1. Create Namespaces

kubectl create namespace jenkins
kubectl create namespace sonarqube
kubectl create namespace nexus
kubectl create namespace argocd
kubectl create namespace gitlab-runner
kubectl create namespace apps

2. Apply RBAC

kubectl apply -f jenkins-rbac.yaml

3. Install Helm Components

helm repo add jenkins https://charts.jenkins.io
helm repo add sonarqube https://SonarSource.github.io/helm-chart-sonarqube
helm repo add sonatype https://sonatype.github.io/helm3-charts/
helm repo add gitlab https://charts.gitlab.io
helm repo update

helm install my-jenkins jenkins/jenkins -n jenkins -f helm-values/jenkins-values.yaml
helm install sonarqube sonarqube/sonarqube -n sonarqube -f helm-values/sonarqube-values.yaml
helm install nexus sonatype/nexus-repository-manager -n nexus -f helm-values/nexus-values.yml
helm install gitlab-runner gitlab/gitlab-runner -n gitlab-runner -f gitlab-runner-values.yaml

4. Install Argo CD (Kustomize)

# Use server-side apply to avoid CRD size limits
kubectl apply -k kustomize-manifests/argocd/ --server-side --force-conflicts

5. Deploy App of Apps

cd gitops-manifests
kubectl apply -f app-of-apps.yaml

6. Retrieve Credentials

# Jenkins
kubectl get secret --namespace jenkins my-jenkins \
  -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode

# Nexus
kubectl exec -it <nexus-pod> -n nexus -- cat /nexus-data/admin.password

# Argo CD
kubectl get secret --namespace argocd argocd-initial-admin-secret \
  -o jsonpath="{.data.password}" | base64 --decode

7. Port Forward

kubectl port-forward svc/my-jenkins -n jenkins 8080:8080
kubectl port-forward svc/sonarqube-sonarqube -n sonarqube 9000:9000
kubectl port-forward svc/nexus-nexus-repository-manager -n nexus 8081:8081
kubectl port-forward svc/argocd-server -n argocd 8083:443

πŸ”„ Disaster Recovery

# 1. Recreate cluster
kind create cluster --config kind-config.yaml

# 2. Recreate namespaces
kubectl create namespace jenkins sonarqube nexus argocd gitlab-runner apps

# 3. Apply RBAC
kubectl apply -f jenkins-rbac.yaml

# 4. Reinstall Helm components
helm install my-jenkins jenkins/jenkins -n jenkins -f helm-values/jenkins-values.yaml
helm install sonarqube sonarqube/sonarqube -n sonarqube -f helm-values/sonarqube-values.yaml
helm install nexus sonatype/nexus-repository-manager -n nexus -f helm-values/nexus-values.yml
helm install gitlab-runner gitlab/gitlab-runner -n gitlab-runner -f gitlab-runner-values.yaml

# 5. Reinstall Argo CD
kubectl apply -k kustomize-manifests/argocd/ --server-side --force-conflicts

# 6. Deploy App of Apps
kubectl apply -f gitops-manifests/app-of-apps.yaml

# 7. Recreate Jenkins credentials (docker-cred, nexus-cred, sonarqube-token, github-cred)
# 8. Regenerate SonarQube token (My Account β†’ Security)
# 9. Reconfigure Nexus Maven proxy (maven-central-proxy + maven-public group)

🚨 Troubleshooting

Issue Cause Fix
SonarQube/Nexus pods restarting Probe timeouts too short Increase initialDelaySeconds, timeoutSeconds, failureThreshold in Helm values
Nexus PVC stuck Terminating Incomplete cleanup Force-delete namespace and reinstall
Argo CD CRD too large for kubectl apply annotation size limit (262KB) Use --server-side --force-conflicts
ZAP: directory /zap/wrk not mounted No volume for report output Mount emptyDir at /zap/wrk in ZAP pod spec
kubectl cp fails on completed pod Pod already exited Keep container alive with sleep 300 after scan
Jenkins RBAC: pods/log forbidden Missing permissions Add pods/log and pods/exec to jenkins-rbac.yaml
GitLab Runner not picking up jobs Wrong executor or token Verify runnerRegistrationToken and executor: kubernetes in Helm values

πŸ—ΊοΈ Roadmap

Phase Description Status
1 Jenkins CI/CD β€” Spring Boot βœ… Complete
2 Argo CD GitOps βœ… Complete
3 GitLab CI β€” Bootstrap App βœ… Complete
4 App of Apps βœ… Complete

πŸ“š References

About

Enterprise-grade DevSecOps CI/CD and GitOps platform for deploying Spring Boot applications to Kubernetes using Jenkins, SonarQube, Nexus, Kaniko, Syft, Grype, and Argo CD.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages