mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
- Replace docker-buildx plugin with Kaniko executor - Remove privileged mode requirement - Fix all Woodpecker linting errors - Update ArgoCD applications to use master branch - Add frontend Dockerfile and nginx config - Add comprehensive CI/CD setup documentation
6.3 KiB
6.3 KiB
CI/CD Pipeline Setup Complete ✅
Overview
Complete CI/CD pipeline configured using:
- Woodpecker CI: Build and test automation
- Kaniko: containerd-compatible image builder
- Harbor Registry: Container image storage
- ArgoCD: GitOps-based deployment
Pipeline Architecture
GitHub Push → Woodpecker CI → Kaniko Build → Harbor Registry → ArgoCD → Kubernetes
Components
1. Woodpecker CI Pipeline (.woodpecker.yml)
Pipeline Steps:
-
Frontend Lint & Test
- Runs on:
push,pull_request - Path:
bugulma/frontend/** - Commands:
yarn install,yarn lint,yarn test
- Runs on:
-
Frontend Build (Kaniko)
- Runs on:
pushtomaster - Path:
bugulma/frontend/** - Builds:
registry.bk.glpx.pro/turash/turash-frontend:latestand:${CI_COMMIT_SHA} - Uses containerd-compatible Kaniko executor
- Runs on:
-
Backend Lint & Test
- Runs on:
push,pull_request - Path:
bugulma/backend/** - Commands:
go vet,go test, coverage
- Runs on:
-
Backend Build (Kaniko)
- Runs on:
pushtomaster - Path:
bugulma/backend/** - Builds:
registry.bk.glpx.pro/turash/turash-backend:latestand:${CI_COMMIT_SHA} - Uses containerd-compatible Kaniko executor
- Runs on:
-
Deploy to Staging (Optional - ArgoCD handles this automatically)
- Runs on:
pushtomaster - Path:
bugulma/**,k8s/** - Manual kubectl deployment (can be disabled if using ArgoCD only)
- Runs on:
-
E2E Tests
- Runs on:
pushtomaster - Path:
bugulma/frontend/** - Uses Playwright for end-to-end testing
- Runs on:
-
Failure Notification
- Runs on: Any failure
- Logs failure information
2. Harbor Container Registry
- URL: https://registry.bk.glpx.pro
- Registry:
registry.bk.glpx.pro - Project:
turash - Credentials: Configured in Woodpecker secrets
3. ArgoCD GitOps
- Backend Application:
turash-backend - Frontend Application:
turash-frontend - Sync Policy: Automated with self-heal
- Source:
https://github.com/SamyRai/turash.git - Path:
k8s/ - Target Revision:
HEAD(updates automatically)
Required Secrets
Woodpecker Secrets
Configure these secrets in Woodpecker for repository SamyRai/turash:
# Docker registry credentials (for Harbor)
woodpecker-cli repo secret add SamyRai/turash \
--name docker_username \
--value admin
woodpecker-cli repo secret add SamyRai/turash \
--name docker_password \
--value "YOUR_HARBOR_PASSWORD"
# Kubernetes token (optional, only if using manual deploy step)
woodpecker-cli repo secret add SamyRai/turash \
--name kube_token \
--value "YOUR_KUBERNETES_TOKEN"
Current Status:
- ✅
docker_username: Configured - ✅
docker_password: Configured - ⚠️
kube_token: Not configured (optional if using ArgoCD only)
Harbor Credentials
- Username:
admin - Password: See
k8s/registry/harbor-secrets.yaml.template
Deployment Flow
Automatic Deployment (Recommended)
- Developer pushes to
masterbranch - Woodpecker triggers pipeline:
- Lints and tests code
- Builds Docker images with Kaniko
- Pushes images to Harbor registry
- ArgoCD detects changes:
- Monitors Git repository
- Detects new image tags in Kubernetes manifests
- Automatically syncs and deploys to Kubernetes
Manual Deployment (Optional)
The deploy-staging step in Woodpecker can manually deploy using kubectl, but this is redundant if ArgoCD is configured with automated sync.
Image Tagging Strategy
Images are tagged with:
latest: Always points to the latest build${CI_COMMIT_SHA}: Specific commit SHA for traceability
Kubernetes deployments should reference specific SHA tags for production:
image: registry.bk.glpx.pro/turash/turash-backend:abc123def456
Verification
Check Woodpecker Pipeline
# List pipelines
woodpecker-cli pipeline ls SamyRai/turash
# View latest pipeline
woodpecker-cli pipeline last SamyRai/turash
# View pipeline logs
woodpecker-cli pipeline logs SamyRai/turash <pipeline-number>
Check Harbor Registry
# Login to Harbor
docker login registry.bk.glpx.pro -u admin -p "PASSWORD"
# List images
curl -u admin:PASSWORD https://registry.bk.glpx.pro/api/v2.0/projects/turash/repositories
# Or via Harbor UI
open https://registry.bk.glpx.pro
Check ArgoCD Applications
# List applications
argocd app list
# Get application status
argocd app get turash-backend
argocd app get turash-frontend
# View application sync status
argocd app sync turash-backend
Check Kubernetes Deployments
# Check pods
kubectl get pods -n turash
# Check deployments
kubectl get deployments -n turash
# Check services
kubectl get svc -n turash
# Check ingress
kubectl get ingress -n turash
Troubleshooting
Pipeline Fails to Build
- Check Kaniko logs: Verify Dockerfile and build context
- Check registry access: Ensure Harbor credentials are correct
- Check secrets: Verify
docker_usernameanddocker_passwordare set
Images Not Deploying
- Check ArgoCD sync status:
argocd app get turash-backend - Check image pull secrets: Ensure Harbor registry secret is configured
- Check image tags: Verify deployment manifests reference correct tags
ArgoCD Not Syncing
- Check repository access: Ensure ArgoCD can access GitHub repository
- Check application status:
argocd app get turash-backend - Check sync policy: Verify automated sync is enabled
Next Steps
- ✅ Pipeline configured - Woodpecker CI with Kaniko
- ✅ Registry configured - Harbor with containerd support
- ✅ GitOps configured - ArgoCD with automated sync
- ⚠️ Optional: Configure
kube_tokensecret if using manual deploy step - 🔄 Test pipeline: Push a commit to trigger the pipeline
- 🔄 Verify deployment: Check ArgoCD sync and Kubernetes pods
Key Features
- ✅ containerd-compatible: Uses Kaniko instead of Docker
- ✅ No privileged mode: Kaniko doesn't require privileged containers
- ✅ Automated deployment: ArgoCD handles GitOps deployments
- ✅ Multi-architecture: Ready for ARM64 and AMD64 (if needed)
- ✅ Caching: Kaniko cache enabled for faster builds
- ✅ Security: Secrets managed via Woodpecker secret store