CI/CD Pipeline
CI/CD Pipeline
Project:
Drop{{PROJECT_NAME}} Version:0.1.0{{VERSION}} Date:2026-02-23{{DATE}} Author:Platform Architect (AI){{AUTHOR}} Status: Draft | In Review | Approved Reviewers:Alem Bašić (CEO){{REVIEWERS}}
Document History
| Version | Date | Author | Changes |
|---|---|---|---|
| 0.1 | Initial draft |
1. Overview
Drop uses GitHub Actions for CI with a 5-job pipeline covering lint, typecheck, unit tests, E2E tests, and Docker build. The CD (automated deployment) pipeline to AWS App Runner is tracked as a pending item — currently CI builds but does not deploy automatically. Staging deployment is manual via fly deploy to Fly.io (Stockholm).
CI/CD Platform: GitHub{{PLATFORM}} Actions (.github/workflows/ci.yml)
Container Registry: AWS{{REGISTRY}} ECR (324480209768.dkr.ecr.eu-west-1.amazonaws.com/drop-web)
Deployment Target (production):Target: AWS{{DEPLOY_TARGET}} App Runner (eu-west-1)
Deployment Target (staging): Fly.io (Stockholm, region arn)
Strategy: Rolling{{STRATEGY}} (App Runner managed)
2. Pipeline Overview
flowchart LR
subgraph Source
PR[Pull Request\nto main/master]Request]
MERGE[PushMerge to\nmain/master]to main]
end
subgraph CI [CI["CI — runs on every push/PR"]
LINT[1.Lint lint-and-typecheck\nnpm& runFormat]
lint\ntscTEST_UNIT[Unit --noEmit]Tests]
TEST[2.TEST_INT[Integration test\nvitestTests]
run]SAST[SAST Scan]
SCA[Dependency Scan]
BUILD[3.Build build\nnext build]
E2E[4. e2e\nPlaywright\nuser-flows + full-flows]
DOCKER[5. docker-build\ndocker build -t drop-app:ci]Artifact]
end
subgraph CD_STG [CD_DEV["CD Staging — manual"Dev Auto-Deploy"]
STG[flyDEPLOY_DEV[Deploy deploy\nFly.ioto Stockholm]Dev]
SMOKE_DEV[Smoke Tests]
end
subgraph CD_PROD [CD_STAGING["CD Production— Staging (auto on main)"]
DEPLOY_STG[Deploy to Staging]
TEST_E2E[E2E Tests]
PERF[Performance Tests]
end
subgraph CD_PROD["CD — pendingProduction implementation"(manual gate)"]
APPROVAL[Manual Approval\nviaApproval]
GitHubDEPLOY_PROD[Deploy Environments]to PROD[awsProduction]
apprunner\nstart-deployment]SMOKE_PROD[Smoke Tests]
MONITOR[Verify Monitoring]
end
PR --> LINT
MERGE --> LINT
LINT --> TESTTEST_UNIT
LINTTEST_UNIT --> TEST_INT
TEST_INT --> SAST
SAST --> SCA
SCA --> BUILD
TESTMERGE --> E2ECD_DEV
BUILD --> E2EDEPLOY_DEV
E2EDEPLOY_DEV --> DOCKERSMOKE_DEV
DOCKERSMOKE_DEV --> STGDEPLOY_STG
DOCKERDEPLOY_STG --> TEST_E2E
TEST_E2E --> PERF
PERF --> APPROVAL
APPROVAL --> PRODDEPLOY_PROD
DEPLOY_PROD --> SMOKE_PROD
SMOKE_PROD --> MONITOR
3. Source Control Configuration
3.1 Branching Strategy
Strategy: GitHub{{BRANCH_STRATEGY}} Flow (feature branches off main, PR into main)
| Branch | Purpose | Naming Convention | Lifetime |
|---|---|---|---|
main |
Production-ready code | fixed | Permanent |
develop |
Integration branch | fixed | Permanent |
feature/* |
New features | feature/{{TICKET}}-description |
Until merged |
fix/* |
Bug fixes | fix/{{TICKET}}-description |
Until merged |
hotfix/* |
Production hotfixes | hotfix/{{TICKET}}-description |
Until merged |
release/* |
Release preparation | release/v{{VERSION}} |
Until merged |
3.2 Branch Protection Rules
Protected Branches: main, develop
| Rule | main |
develop |
|---|---|---|
| Require PR | Yes | Yes |
| Required approvals | {{APPROVALS}} | 1 |
| Dismiss stale reviews | Yes | Yes |
| Require status checks | Yes | Yes |
| Required checks | lint, unit-tests | |
| Require up-to-date | Yes | No |
| Allow force push | No | No |
| Allow deletions | No | No |
3.3 Code Review Requirements
- Minimum
1{{APPROVALS}}approvalapproval(s) required before merge - At least one approval from
AlemaBašićcode owner (orseedelegated lead)CODEOWNERS) - All review comments must be resolved before merge
- Review turnaround SLA:
24{{REVIEW_SLA}} business hours - Auto-assign reviewers via: {{ASSIGN_MECHANISM}}
4. Build Stage
4.1 Build Tool & Configuration
| Parameter | Value |
|---|---|
| Build Tool | |
|
|
| Build Command | |
| Artifact Type | |
| Artifact Naming | |
| Tag Strategy | git-sha for semver for releases |
| |
|
Multi-stage build:
Stage 1: deps — npm ci + native dependencies
Stage 2: builder — npm run build (Next.js standalone)
Stage 3: runner — minimal image, copies only public/ + .next/standalone/ + .next/static/
4.2 Dependency Caching
| Cache | Key | Restore Keys |
|---|---|---|
| Node modules | node-modules- |
node-modules- |
| Docker |
|
buildx- |
| Test results | test-results-{{COMMIT_SHA}} |
N/A |
4.3 Artifact Generation
| Artifact | Storage | Retention | Signed |
|---|---|---|---|
| Docker image | |
90 days (non- |
|
storage |
No | ||
|
Yes | ||
| Coverage report | {{COVERAGE_STORAGE}} | 30 days | No |
5. Test Stages
5.1 Unit Tests
| Parameter | Value |
|---|---|
| Framework | |
| Command | |
| |
|
|
| Coverage Tool | |
| Coverage Gate | |
| Failure Action | Block PR merge |
5.2 Integration Tests
| Parameter | Value |
|---|---|
| Framework | |
| Command | |
| Dependencies | |
| Failure Action | Block PR merge |
5.3 E2E Tests
| Parameter | Value |
|---|---|
| Framework | |
| Command | |
|
|
| Environment | |
| Parallelization | |
| |
| |
|
|
| Failure Action | Block |
5.4 Security Scanning
| Scan Type | Tool | Gate | |
|---|---|---|---|
| SAST | {{SAST_CMD}} |
Block on HIGH/CRITICAL | |
| SCA (dependencies) | |
{{SCA_CMD}} |
Block on CRITICAL |
| Container scan | {{CONTAINER_SCAN_CMD}} |
Block on CRITICAL | |
| Secret scanning | {{SECRET_SCAN_CMD}} |
Block on any finding |
Note: Security scanning tracked in security/hardening-checklist.md. npm audit and Snyk integration are pending.
5.5 Linting & Formatting
| Tool | Purpose | Command | Auto-fix |
|---|---|---|---|
| Code linting | |
PR comment | |
| Code formatting | {{FMT_CMD}} |
Auto-commit or fail | |
| {{TYPE_CHECK}} | Type checking | |
No |
6. Deploy Stages
6.1 Deployment Strategy
Strategy: Rolling{{DEPLOY_STRATEGY}} (App Runner managed)
App Runner handles deployment atomically — new container version deployed, health checks verified, traffic shifted. No blue-green or canary at this stage.
App RunnerRolling Deployment:
Trigger:Batchofawssize:apprunner{{BATCH_SIZE}}%start-deployment(currentlyinstances- Pause between batches: {{PAUSE}}min
- Health
check:checkGETwait:/api/healthevery 30s{{HEALTH_WAIT}}s Auto-rollback:RollbackApp Runner reverts if new deployment failstrigger: healthcheckscheck Deployment time: ~3-5 minutesfailure
StagingCanary Deployment (Fly.io)if Deployment:used):
Command:Initialweight:flycanarydeploy(manual){{CANARY_INITIAL}}%Region:Increment:{{CANARY_INCREMENT}}%arn(Stockholm)every {{CANARY_INTERVAL}}minAuto-scale:PromotionScalescriteria:toerror0ratewhen<idle,{{ERROR_THRESHOLD}}%,auto-startsp99 < {{LATENCY_THRESHOLD}}ms- Rollback trigger: automatic on
requestthreshold breach
6.2 Environment Promotion
PR Branch → CIDev (auto) → Staging (manualauto flyon deploy)main merge) → Production (manual apprunner start-deployment)approval)
| Promotion | Trigger | Gate | Approver |
|---|---|---|---|
| → |
develop / PR |
All CI checks pass | |
| → Staging | Merge to main |
All CI + Dev smoke tests | Automatic |
| → Production | v*.*.* |
All |
6.3 Approval Gates
Production Approval Required: Yes
(manual)
Approvers: Alem Bašić{{PROD_APPROVERS}} (soleat approverleast during{{APPROVAL_COUNT}} MVP phase)required)
Approval Window: No automated timeout{{APPROVAL_WINDOW}}h (manualpipeline process)cancels after timeout)
Emergency Override: Direct{{EMERGENCY_OVERRIDE}} aws apprunner start-deployment via AWS Console (Alem only)
6.4 Feature Flags Integration
Feature Flag Tool: Environment{{FF_TOOL}} variables
(build-timeFlag via Next.js NEXT_PUBLIC_FF_* pattern)
| |||
| |||
| |||
| |||
| |||
| |||
| |||
|
Note:Validation: FlagsFeature areflags bakedvalidated in atstaging buildbefore timeproduction bydeploy
Next.js.Kill ChangingSwitch: a flag requires aAll new buildfeatures andbehind deployment.flags for first {{FF_PERIOD}} days
7. Post-Deploy
7.1 Smoke Tests
| Check | Expected | Timeout |
|---|---|---|
Health endpoint GET / |
HTTP 200 |
10s |
401 |
10s | |
| Database connection | Healthy | 15s |
connection |
10s | |
Smoke test timeout: 2 {{SMOKE_TIMEOUT}}min total
On failure: Manual Auto-rollback via App Runner console (revert to previous deployment)triggered
7.2 Monitoring Verification
After each deployment, verify via BetterStack and Slack:
| Metric | Threshold | Check Duration |
|---|---|---|
| 5 min |
||
{{P99}}ms |
||
< {{CPU}}% |
||
|
7.3 Rollback Triggers
Automatic rollback triggers:
AppSmokeRunnertesthealthfailure- Error rate > {{AUTO_ROLLBACK_ERROR}}% for {{AUTO_ROLLBACK_DURATION}}min post-deploy
- Health check failure
duringondeployment{{HEALTH_FAIL_THRESHOLD}}%(AppofRunner native) BetterStack detects downtime → Slack alert → manual investigationinstances
Manual rollback: See rollback-plan.md
# Rollback via AWS CLI (revert to previous ECR image)
aws apprunner start-deployment \
--service-arn arn:aws:apprunner:eu-west-1:324480209768:service/drop-web/8e45b0d335304487a1880f4e32d6aeec \
--region eu-west-1
8. Pipeline Configuration Reference
Config File Location: {{CONFIG_PATH}} .github/workflows/ci.yml
Key environment variables injected by CI:
| Variable | Source | Purpose |
|---|---|---|
|
||
|
||
SENTRY_DSN |
{{SECRET_STORE}} | Error |
SLACK_WEBHOOK |
9. Secret Injection Strategy
Strategy: GitHub{{SECRET_STRATEGY}} Actions Secrets for CI variables; AWS Secrets Manager for runtime application secrets.
| Secret Type | Storage | Injection Method | Rotation |
|---|---|---|---|
| Registry credentials |
{{METHOD}} | {{ROTATION}} | |
| Cloud credentials | {{STORAGE}} | OIDC |
Per-job |
| App secrets |
|||
OIDC Preferred: GitHubCloud Actionscredentials usesinjected via OIDC to assume AWS IAM role — no long-lived AWS keys stored in GitHub.CI
10. Pipeline Metrics
| Metric | Target | Current |
|---|---|---|
| Build duration (P50) | < |
TBD |
| < |
TBD | |
| Total pipeline duration | < |
TBD |
| Deploy frequency | TBD | |
| Lead time for changes | < |
TBD |
| Change failure rate | < |
TBD |
| MTTR | < |
TBD |
Related Documents
- Deployment Architecture
- Environment Configuration
DisasterDeploymentRecoveryChecklist- Rollback Plan
- Test Strategy
Approval
| Role | Name | Date | Signature |
|---|---|---|---|
| Author | |||
| Reviewer | |||
| Approver |