Production Promotion and Deployment Notifications¶
This guide explains how to use the manual production promotion process and deployment success notifications in the CI/CD pipeline.
Overview¶
The CI/CD pipeline includes two key features for production deployments:
- Manual Production Promotion: Creates a PR requiring manual review before promoting services from staging to production
- Deployment Success Notifications: Automatically notifies the source repository when ArgoCD successfully deploys services
Manual Production Promotion¶
How It Works¶
After staging deployment succeeds:
- Automatic Trigger: The
promote-to-productionjob automatically starts after successful staging promotion - Create PR: Job copies service versions from staging to production and creates a PR in
cluster-gitops - Workflow Completes: CI/CD workflow finishes successfully after PR creation
- Manual Review: Administrator reviews the PR in the
cluster-gitopsrepository - Manual Merge: Administrator approves and merges the PR manually
- ArgoCD Sync: Production cluster automatically syncs with new versions after merge
Key Point: No GitHub Environment configuration required. The manual gate happens at the PR merge step in cluster-gitops.
Workflow Overview¶
CI/CD Build → Staging Promotion → Production PR Created → Workflow Complete
↓
(Manual Review in cluster-gitops)
↓
PR Merged → ArgoCD Syncs Production
Production Promotion Process¶
Step 1: Automatic PR Creation¶
When code is pushed to main and staging deployment succeeds:
- CI/CD runs: All services build and deploy to staging
- Production job triggers:
promote-to-productionjob starts automatically - PR created: A new PR is created in
cluster-gitopswith the labelrequires-review - Workflow completes: CI/CD workflow shows success
Step 2: Review the Production PR¶
- Navigate to cluster-gitops:
- Go to https://github.com/camaradesuk/cluster-gitops/pulls
-
Look for PRs with label
requires-review -
Review the changes:
- Check which services are being updated
- Verify versions match what's in staging
-
Review the checklist in PR description
-
Checklist to verify (included in PR):
- All services have been tested in staging
- No critical issues reported in staging
- Release notes reviewed (if applicable)
- Stakeholders notified of production deployment
Step 3: Approve and Merge¶
Option 1: Merge via GitHub UI
- Click "Merge pull request" button
- Confirm merge
- PR is merged to main
- ArgoCD detects changes and syncs production
Option 2: Merge via CLI
cd /path/to/cluster-gitops
gh pr list --label requires-review
gh pr view <PR_NUMBER> # Review changes
gh pr merge <PR_NUMBER> --squash --delete-branch
Step 4: Monitor Deployment¶
After merging:
- Check ArgoCD sync:
- Watch deployment progress:
# For specific service (e.g., API)
kubectl get pods -n syrf-production -l app.kubernetes.io/name=syrf-api -w
- Verify new version:
kubectl get deployment api-production-syrf-api -n syrf-production \
-o jsonpath='{.spec.template.spec.containers[0].image}'
Example Production PR¶
The automated PR will look like this:
## Production Promotion - Manual Review Required
This PR promotes services from staging to production.
**⚠️ MANUAL REVIEW REQUIRED**: This PR requires manual approval and merge by an administrator.
**Source Run**: [42](https://github.com/camaradesuk/syrf-test/actions/runs/19340633801)
**Source Commit**: 6b47f42a
**Created By**: platform-bot
### Services Updated
- API: `api-v8.21.0`
- Web: `web-v5.0.1`
- Docs: `docs-v1.2.3`
### Review Checklist
Before merging, please verify:
- [ ] All services have been tested in staging
- [ ] No critical issues reported in staging
- [ ] Release notes reviewed (if applicable)
- [ ] Stakeholders notified of production deployment
### Deployment
Once merged, ArgoCD will automatically sync the changes to the production cluster.
Deployment Success Notifications¶
How It Works¶
After ArgoCD successfully syncs a service to staging or production:
- PostSync Hook: ArgoCD triggers a Kubernetes Job after successful sync
- GitHub App Authentication: Job uses GitHub App credentials from cluster secrets
- API Call: Creates a commit status on the source repository
- Status Details:
- Context:
argocd/deploy-{environment}(e.g.,argocd/deploy-staging) - State:
success - Description: "Deployed {service}:{version} to {environment}"
- Target URL: Link to deployed service
Enabling Deployment Notifications¶
Prerequisites:
- GitHub App credentials must be available in the cluster
- Secret
github-app-credentialsmust exist in the service namespace
Configuration Overview¶
Deployment notification configuration follows DRY principle with three levels of inheritance:
- Environment Shared Values (
cluster-gitops/environments/{env}/shared-values.yaml): - Contains common configuration for ALL services in that environment
- Already configured with defaults (githubOrg, githubRepo, credentials, etc.)
-
Services inherit these values automatically
-
Service-Specific Values (if needed):
- Override only what's unique to the service
- Typically only need to set
enabled: true
Step 1: Enable Notifications for a Service¶
Edit the service's environment-specific values file in cluster-gitops/environments/{env}/services/{service}.yaml:
# Example: environments/staging/services/api.yaml
service:
name: api
chartTag: api-v8.21.0
# Enable deployment notifications - inherits config from shared-values.yaml
deploymentNotification:
enabled: true # This is all you need!
# commitSha will be populated by CI/CD during promotion
That's it! The service inherits all other configuration from environments/staging/shared-values.yaml:
githubOrg: camaradesukgithubRepo: syrf-testcredentialsSecret: github-app-credentialsserviceAccount: defaultcreateReleaseNote: false(staging) ortrue(production)
Step 2: Ensure GitHub App Credentials Exist¶
Verify the secret exists:
Expected output:
If missing, the extra-secrets chart should create it automatically from Google Secret Manager.
Step 3: (Optional) Override Configuration¶
If a service needs custom configuration different from shared values, you can override in the service file:
# Example: environments/staging/services/api.yaml
service:
name: api
chartTag: api-v8.21.0
deploymentNotification:
enabled: true
# Override only if needed (inherits from shared-values.yaml by default)
githubRepo: different-repo # Only if this service uses a different repo
createReleaseNote: true # Only if you want releases in staging (unusual)
Note: In most cases, you won't need any overrides - shared values cover all services.
Viewing Deployment Notifications¶
Commit Statuses¶
- Go to the commit in GitHub (e.g.,
https://github.com/camaradesuk/syrf-test/commit/{sha}) - Scroll to Checks section
- Look for statuses like:
- ✅
argocd/deploy-staging- Deployed api:8.21.0 to staging - ✅
argocd/deploy-production- Deployed api:8.21.0 to production
GitHub Releases (Optional)¶
If createReleaseNote: true:
- Go to Releases tab in GitHub
- Look for releases named like:
api deployed to staging - Each release includes:
- Service name and version
- Environment (staging/production)
- Deployment timestamp
- URL to deployed service
Troubleshooting Deployment Notifications¶
PostSync Job Not Running¶
Check if the job exists:
If not running, check ArgoCD Application status:
Job Fails to Authenticate¶
Check job logs:
POD=$(kubectl get pods -n syrf-staging -l job-name -o name | tail -1)
kubectl logs $POD -n syrf-staging
Common issues:
- Missing
github-app-credentialssecret - Invalid GitHub App private key
- Insufficient GitHub App permissions
Status Not Appearing on GitHub¶
Verify the commit SHA is correct:
Check GitHub App installation:
# Get installation ID
curl -H "Authorization: Bearer {JWT}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/orgs/camaradesuk/installation"
Best Practices¶
Production Promotion¶
- Always test in staging first: Never bypass staging for production deployments
- Review PR changes: Check the cluster-gitops PR before merging to production
- Monitor deployments: Watch ArgoCD sync status after merging
- Rollback plan: Know how to revert production deployments quickly
- Communication: Notify stakeholders before merging production PRs
Deployment Notifications¶
- Start disabled: Enable notifications after testing in staging
- Use commit statuses: Don't create releases for every deployment (noise)
- Monitor job failures: Set up alerts for failed PostSync jobs
- Clean up old jobs: Jobs auto-delete after 5 minutes (TTL)
Security Considerations¶
GitHub App Permissions¶
The GitHub App needs these permissions:
- Repository permissions:
statuses: write- Create commit statuses-
contents: write- Create releases (if enabled) -
Organization permissions:
members: read- Verify installation
Production PR Protection¶
Best practices for cluster-gitops repository:
- Branch protection on main: Require PR reviews before merging
- CODEOWNERS file: Automatically request reviews from platform team
- Status checks: Require YAML validation to pass
- Audit logs: Review who merged production PRs
Related Documentation¶
- CI/CD Workflow - Complete CI/CD pipeline documentation
- GitOps GitHub App Setup - Configure GitHub App authentication
- ArgoCD Architecture - GitOps deployment architecture
Troubleshooting¶
Production Promotion Fails¶
Symptom: promote-to-production job fails after staging success
Solutions:
- Check PR creation errors:
- Verify GitHub App token:
- App ID and private key are correct
- App is installed on
cluster-gitopsrepository -
App has
contents: writeandpull_requests: writepermissions -
Check YAML validation:
- Ensure all service files are valid YAML
- Check for syntax errors in updated files
Deployment Notification Job Timeout¶
Symptom: PostSync job exceeds 5-minute TTL
Solutions:
- Increase job timeout (not recommended):
- Simplify notification logic:
- Remove release creation
-
Use commit statuses only
-
Check GitHub API rate limits:
Future Enhancements¶
Planned improvements:
- Slack notifications: Send deployment notifications to Slack channels
- Deployment metrics: Track deployment frequency and success rates
- Automated rollback: Trigger rollback on failed health checks
- Progressive delivery: Canary deployments with automatic promotion