Overview
The GovTech Multicloud Platform uses GitHub Actions for CI/CD automation across backend, frontend, and infrastructure components. All workflows implement security-first practices with OIDC authentication and comprehensive scanning.Pipeline Architecture
Workflow Files
| Workflow | Trigger | Purpose |
|---|---|---|
security-scan.yml | PR/Push to main/staging | Security scanning on all code changes |
backend-ci.yml | Push/PR to backend paths | Build, test, and publish backend images |
frontend-ci.yml | Push/PR to frontend paths | Build, test, and publish frontend images |
deploy-dev.yml | Push to staging | Auto-deploy to development environment |
deploy-prod.yml | Manual workflow_dispatch | Blue-green production deployment |
Backend CI Pipeline
File:.github/workflows/backend-ci.yml
Triggers
Jobs
1. Test Job
Runs linting, security audits, and tests:- Node.js 20 with dependency caching
- Blocking security audit (no
|| truebypass) - Runs on every push and PR
2. Build and Push Job
Builds Docker image, scans for vulnerabilities, and pushes to ECR: Prerequisites:needs: test- Only runs after test job succeeds- Condition: Push to main or staging branch only
-
OIDC Authentication (backend-ci.yml:71-77)
-
Build Docker Image (backend-ci.yml:88-96)
-
Trivy Vulnerability Scan (backend-ci.yml:98-108)
-
Push to ECR (backend-ci.yml:110-119)
- Only executes if Trivy scan passes
- Pushes both SHA tag and latest tag
-
Generate SBOM (backend-ci.yml:126-139)
Security Improvements
The workflow includes critical security fixes:- Removed
|| truebypass (backend-ci.yml:46-48):npm auditnow blocks on HIGH/CRITICAL vulnerabilities - Scan before push (backend-ci.yml:86-87): Vulnerable images never reach ECR
- Exit code enforcement (backend-ci.yml:103-105): Trivy fails pipeline instead of just reporting
Frontend CI Pipeline
File:.github/workflows/frontend-ci.yml
Triggers
Jobs
1. Test Job
2. Build and Push Job
Identical to backend workflow:- OIDC authentication
- Build Docker image (
govtech-frontend:$IMAGE_TAG) - Trivy scan (blocks on CRITICAL/HIGH)
- Push to ECR
- Generate and upload SBOM (90-day retention)
OIDC Authentication
All CI workflows use OpenID Connect instead of long-lived AWS access keys.Required Permissions
Configuration
Step: Configure AWS credentials (backend-ci.yml:71-77)Benefits
- Temporary credentials: Tokens expire in 1 hour
- No secret storage: No long-lived keys in GitHub Secrets
- Audit trail: AWS CloudTrail logs all OIDC authentications
- Principle of least privilege: IAM role has minimal required permissions
Prerequisites
Requires OIDC provider configured in AWS (see Infrastructure documentation).Image Tags
All Docker images use dual tagging:- Development: Uses
latesttag - Production: Uses specific SHA tag for immutability
SBOM Generation
Software Bill of Materials (SBOM) generation is mandatory for compliance.Format
CycloneDX JSON - Industry standard for dependency trackingRetention
- Development SBOMs: 7 days
- Production SBOMs: 90 days (compliance requirement)
Contents
SBOM includes:- All npm dependencies (direct and transitive)
- System packages in Docker base image
- Versions and license information
- Known CVEs for each component
Access
Download from GitHub Actions artifacts:Environment Variables
GitHub Secrets Required
| Secret | Used In | Purpose |
|---|---|---|
AWS_DEPLOY_ROLE_ARN | backend-ci.yml, frontend-ci.yml | OIDC role for ECR access |
AWS_ACCESS_KEY_ID | deploy-dev.yml, deploy-prod.yml | Legacy credential (migrate to OIDC) |
AWS_SECRET_ACCESS_KEY | deploy-dev.yml, deploy-prod.yml | Legacy credential |
DB_PASSWORD | deploy-dev.yml | Database password for Terraform |
Workflow Outputs
Path-based Triggers
Workflows only run when relevant files change:- Faster CI runs
- Reduced GitHub Actions minutes
- Clear separation of concerns
Branch Strategy
- feature/: Development branches, triggers security scans
- staging: Auto-deploys to dev environment
- main: Production-ready code, manual deployment
Monitoring and Artifacts
Artifact Retention
| Artifact | Retention | Purpose |
|---|---|---|
| Frontend build | 7 days | Static assets |
| Backend SBOM | 90 days | Compliance/audit |
| Frontend SBOM | 90 days | Compliance/audit |
| Semgrep results | 30 days | Security analysis |
Status Checks
Required checks before merge:- Security Scan (all jobs must pass)
- Backend CI: Test job
- Frontend CI: Test job
Best Practices
Do’s
- Always scan images before pushing to ECR
- Use OIDC authentication for cloud providers
- Generate SBOMs for all production images
- Tag images with git SHA for traceability
- Set appropriate artifact retention periods
Don’ts
- Don’t use
|| trueto bypass security failures - Don’t push images before vulnerability scanning
- Don’t use long-lived AWS access keys
- Don’t skip SBOM generation
- Don’t use
latesttag in production deployments
Troubleshooting
npm audit failures
Trivy scan failures
OIDC authentication errors
Check:- IAM role trust policy includes GitHub OIDC provider
AWS_DEPLOY_ROLE_ARNsecret is correct- Workflow has
id-token: writepermission