Table of Contents
Phase 5: CI/CD Integration
Duration: 30-45 minutes
Purpose: Configure GitLab CI/CD and webhooks
Dependencies: Phase 4 complete, ArgoCD accessible
Overview
This phase integrates GitLab CI/CD with the Blueberry infrastructure, enabling automated builds, deployments, and notifications. It includes Workload Identity Federation setup for secure authentication.
📋 Setup Steps
- GitLab CI/CD Variables
- Configure GitLab project variables
- Set up webhook authentication tokens
-
Configure environment-specific settings
- Configure GitLab webhooks for pipeline notifications
- Set up Slack integration
-
Test webhook delivery
- Understand WIF authentication flow
- Configure GitLab CI/CD for GCP authentication
-
Test service account permissions
- Run first CI/CD pipeline
- Verify image build and push
- Test deployment workflow
🎯 Success Criteria
After completing this phase, you should have:
- GitLab Variables - All required CI/CD variables configured
- Webhook Integration - Pipeline notifications working in Slack
- WIF Authentication - GitLab CI can authenticate with GCP
- Successful Pipeline - First build and deployment completed
- Artifact Registry - Docker images being pushed successfully
⏭️ Next Phase
Once CI/CD is working and pipelines are successful, proceed to Phase 6: Application Deployment
🔧 Key Commands
# Test GitLab CI/CD authentication
gcloud auth list
gcloud projects list
# Check webhook token in Secret Manager
gcloud secrets versions access latest --secret="gitlab-webhook-token"
# Test webhook endpoint
curl -X GET https://blueberry.florenciacomuzzi.com/api/webhooks/gitlab/test
# Monitor pipeline in GitLab
# Go to GitLab project → CI/CD → Pipelines
# Check ArgoCD for automatic updates
kubectl get applications -n argocd
📊 GitLab CI/CD Variables
Variable | Purpose | Type | Example |
---|---|---|---|
GITLAB_WEBHOOK_TOKEN |
Webhook authentication | Protected | abc123... |
BLUEBERRY_WEBHOOK_URL |
Webhook endpoint | Protected | https://blueberry.florenciacomuzzi.com/api/webhooks/gitlab/pipeline |
GCP_PROJECT_ID |
GCP project identifier | Public | development-454916 |
GCP_SERVICE_ACCOUNT_EMAIL |
WIF service account | Public | gitlab-ci@development-454916.iam.gserviceaccount.com |
🔄 CI/CD Pipeline Stages
- Lint - Code quality checks with pre-commit
- Test - Run unit and integration tests
- Build - Build Docker image for linux/amd64
- Deploy - Push to Artifact Registry, trigger ArgoCD sync
⏰ Timing Considerations
- GitLab Variable Setup: 5-10 minutes
- Webhook Configuration: 5-10 minutes
- First Pipeline Run: 10-15 minutes
- Image Build Time: 5-10 minutes per build
🚨 Common Issues
- Authentication Failures: Verify WIF setup and service account roles
- Image Push Errors: Check Artifact Registry permissions
- Webhook Failures: Validate token and endpoint URL
- Pipeline Timeouts: Increase timeout values or optimize builds
📚 Documentation
Document ID: setup/05-cicd/README