A sample Spring Boot REST API for tracking fitness workouts, demonstrating complete GitOps CI/CD with CloudBees CI, ArgoCD multi-cluster deployment, and comprehensive automated testing.
- REST API for managing workouts (CRUD operations)
- Spring Boot Actuator for health checks and monitoring
- H2 in-memory database
- Docker containerized with multi-stage builds
- Kubernetes Helm chart deployment
- Complete GitOps CI/CD pipeline with CloudBees CI + ArgoCD
- Multi-cluster deployment (dev → test → prod)
- Automated testing (Unit, Functional, Performance, Security)
- Jira integration for automated issue tracking
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/workouts |
Get all workouts |
| GET | /api/workouts/{id} |
Get workout by ID |
| POST | /api/workouts |
Create new workout |
| PUT | /api/workouts/{id} |
Update workout |
| DELETE | /api/workouts/{id} |
Delete workout |
| GET | /api/workouts/health |
Health check |
| GET | /actuator/health |
Spring Actuator health |
# Run with Maven
mvn spring-boot:run
# Or build and run JAR
mvn clean package
java -jar target/fitness-tracker-1.0.0.jar
# Access at http://localhost:8080# Build image
docker build -t fitness-tracker:latest .
# Run container
docker run -p 8080:8080 fitness-tracker:latest# Install
helm install fitness-tracker k8s/helm-chart --namespace dev --create-namespace
# Upgrade
helm upgrade fitness-tracker k8s/helm-chart --namespace dev
# Uninstall
helm uninstall fitness-tracker --namespace devGitHub Push → Webhook → CloudBees CI (kind-igs)
↓
Build & Test → Docker Hub → Update Git values.yaml
↓
ArgoCD Detects Change → Multi-Cluster Sync
↓
kind-dev (develop) | kind-test (main)
- Setup & Checkout - Clone repository, detect changes
- Build & Test - Maven build with JUnit tests
- Aikido Security Scan - Dependency vulnerability scanning
- Docker Build & Push - Build image with build-specific tag, push to DockerHub
- Update Helm Chart - Commit new image tag to Git values.yaml
- ArgoCD Deployment - Trigger ArgoCD sync to target cluster
- Verify ArgoCD Sync - Wait for ArgoCD to sync successfully
- Wait for Deployment - Verify pods running with correct image
- Run Tests in Parallel - SoapUI API + JMeter performance + ZAP security tests
- Collect Build Artifacts - Archive test results and reports
- Publish to CloudBees Unify - Send metrics and results
- Jira Integration - Auto-create ticket on pipeline failure
| Branch | ArgoCD App | Target Cluster | Image Tag Pattern |
|---|---|---|---|
develop |
fitness-tracker-dev | kind-dev (172.18.0.5:6443) | develop-{BUILD_NUMBER} |
main |
fitness-tracker-test | kind-test (172.18.0.8:6443) | main-{BUILD_NUMBER} |
- Automated GitOps: ArgoCD reads image tags from Git, no manual intervention
- Multi-cluster: Single ArgoCD on kind-igs manages deployments to multiple clusters
- Dynamic Tagging: Each build creates unique image tag (e.g.,
develop-5,main-12) - Failure Tracking: Automatic Jira ticket creation on pipeline failures
- Comprehensive Testing: Parallel execution of API, performance, and security tests
Tests all API endpoints for correct responses.
# Run SoapUI tests
kubectl exec -n soapui deployment/soapui -- testrunner.sh /path/to/project.xmlLoad testing with configurable users and duration.
# Run JMeter test
kubectl exec -n jmeter deployment/jmeter -- jmeter -n -t load-test.jmx -l results.jtlAutomated security vulnerability scanning.
# Spider application
curl 'http://zap.zap.svc.cluster.local:8080/JSON/spider/action/scan/?url=http://fitness-tracker'
# Active scan
curl 'http://zap.zap.svc.cluster.local:8080/JSON/ascan/action/scan/?url=http://fitness-tracker'
# Get results
curl 'http://zap.zap.svc.cluster.local:8080/JSON/core/view/alerts/'| Cluster | Purpose | Context | Server URL | Deployed From |
|---|---|---|---|---|
| kind-igs | CI/CD Control Plane | kind-igs | 172.18.0.2:6443 | CloudBees CI + ArgoCD running here |
| kind-dev | Development | kind-kind-dev | 172.18.0.5:6443 | develop branch via ArgoCD |
| kind-test | QA/Testing | kind-kind-test | 172.18.0.8:6443 | main branch via ArgoCD |
ArgoCD running on kind-igs manages applications on kind-dev and kind-test:
# View registered clusters
argocd cluster list
# Check application status
argocd app get fitness-tracker-dev
argocd app get fitness-tracker-test
# Manual sync (if needed)
argocd app sync fitness-tracker-devArgoCD UI: https://backspin-feline-pesticide.ngrok-free.dev/argocd
Credentials: admin / GJIRlUm5H-YShZnM
- Developer pushes to
developormainbranch - GitHub webhook triggers Jenkins build on kind-igs
- Jenkins builds Docker image with unique tag (e.g.,
main-5) - Jenkins pushes image to Docker Hub
- Jenkins updates
k8s/helm-chart/values.yamlin Git with new tag - ArgoCD detects Git change automatically (polls every 3 minutes)
- ArgoCD syncs to target cluster using Helm chart from Git
- Kubernetes deploys pods with the new image tag
- Pipeline verifies deployment health and runs tests
✅ Single Source of Truth: Git repository contains desired state
✅ Declarative Configuration: Helm charts define application state
✅ Automated Sync: ArgoCD continuously reconciles cluster state with Git
✅ Audit Trail: All changes tracked via Git commits
✅ Rollback: Easy rollback by reverting Git commits
See ARGOCD-ACCESS-GUIDE.md and create-argocd-apps.sh for setup details.
| Credential ID | Type | Purpose |
|---|---|---|
DOCKERHUB_PASSWORD |
Secret text | Docker Hub authentication |
GITHUB_TOKEN |
Secret text | Git push authentication |
GITHUB_USERNAME |
Secret text | Git username |
AIKIDO_API_KEY |
Secret text | Aikido security scanning |
jira-api-token |
Secret text | Jira ticket creation on failures |
Link commits to Jira issues for traceability:
git commit -m "CBDEMO-123: implement new feature"
git push origin mainThis creates automatic links in Jira between tickets and code changes.
Jenkinsfile.kubernetes - Update these variables:
DOCKER_REPO = 'anuddeeph2' // Your Docker Hub username
JIRA_SITE = 'https://cloudbees.atlassian.net'
JIRA_PROJECT_KEY = 'CBDEMO'
JIRA_EMAIL = 'your-email@example.com'k8s/helm-chart/values.yaml - Image repository:
image:
repository: anuddeeph2/sample-spring-boot-app // Your Docker Hub repo
tag: develop-1 # Managed by Jenkins, don't edit manually
pullPolicy: Alwayssample-spring-app/
├── src/
│ └── main/
│ ├── java/com/example/demo/
│ │ ├── FitnessTrackerApplication.java
│ │ ├── Workout.java
│ │ ├── WorkoutRepository.java
│ │ └── WorkoutController.java
│ └── resources/
│ └── application.yml
├── k8s/
│ └── helm-chart/
│ ├── Chart.yaml
│ ├── values.yaml
│ └── templates/
│ ├── deployment.yaml
│ ├── service.yaml
│ └── ingress.yaml
├── Dockerfile
├── Jenkinsfile
├── pom.xml
└── README.md
curl -X POST http://fitness-tracker.local/api/workouts \
-H "Content-Type: application/json" \
-d '{
"type": "Running",
"duration": 30,
"caloriesBurned": 300,
"date": "2024-01-15T10:00:00",
"notes": "Morning run"
}'curl http://fitness-tracker.local/api/workoutscurl -X PUT http://fitness-tracker.local/api/workouts/1 \
-H "Content-Type: application/json" \
-d '{
"type": "Running",
"duration": 45,
"caloriesBurned": 450,
"date": "2024-01-15T10:00:00",
"notes": "Extended morning run"
}'curl -X DELETE http://fitness-tracker.local/api/workouts/1Access Spring Boot Actuator endpoints:
# Health check
curl http://fitness-tracker.local/actuator/health
# Metrics
curl http://fitness-tracker.local/actuator/metrics
# All endpoints
curl http://fitness-tracker.local/actuator- Check DockerHub credentials in Jenkins
- Verify Docker registry is accessible
- Ensure DockerHub username is correct in Jenkinsfile
- Check ArgoCD Application status:
argocd app get fitness-tracker-dev - Verify Git repository is accessible
- Check if Helm chart is valid:
helm lint k8s/helm-chart
- SoapUI: Check if application is accessible from soapui pod
- JMeter: Verify target URL is correct
- ZAP: Ensure ZAP service is running:
kubectl get pods -n zap
- MULTI-CLUSTER-ARGOCD-SETUP.md - Multi-cluster setup guide
- ZAP-INTEGRATION-GUIDE.md - ZAP security testing
- JMETER-INTEGRATION-GUIDE.md - JMeter performance testing
- SOAPUI-INTEGRATION-GUIDE.md - SoapUI API testing
- COMPLETE-TESTING-STACK.md - Testing stack overview
MIT License - Sample application for demonstration purposes.