Back

gstack Tutorial 10: Release Engineering (Ship, Deploy, Canary, Benchmark)

/ship syncs main, runs tests, audits coverage, pushes, opens PR. /land-and-deploy merges, waits for CI, deploys, verifies production. /canary monitors post-deploy. /benchmark tracks performance baseline.

Tutorial Overview

Series index: gstack Tutorial Series

The release engineering skills form a complete CI/CD pipeline: /ship/land-and-deploy/canary/benchmark.

What you will learn

  • /ship full release workflow
  • ✅ Test framework bootstrap
  • ✅ Coverage audit on every ship
  • /land-and-deploy merge → CI → deploy → verify
  • /canary post-deploy monitoring
  • /benchmark performance baseline tracking

Release Pipeline Overview

flowchart TD
    A[Code Complete] --> B[/ship]
    B --> C[PR Created]
    C --> D[Human Approve]
    D --> E[/land-and-deploy]
    E --> F[CI Pass]
    F --> G[Deploy]
    G --> H[/canary]
    H --> I{Errors?}
    I -->|Yes| J[Rollback]
    I -->|No| K[/benchmark]
    K --> L[Baseline Updated]

    style B fill:#fff3e0
    style E fill:#e8f5e9
    style H fill:#ffebee
    style K fill:#e1f5ff

/ship — Push and PR

What it does

  1. Sync main — Fetch latest, rebase your branch
  2. Run tests — Full test suite
  3. Audit coverage — Every /ship produces coverage report
  4. Push branch — Force push with lease (safe)
  5. Open PR — Creates PR with standard template

Usage

/ship

Output:

Running /ship workflow...

┌─────────────────────────────────────────────────────────────┐
│ SHIP WORKFLOW                                                │
├─────────────────────────────────────────────────────────────┤
│ Step 1: Sync main                                            │
│ ✅ Fetched origin/main                                       │
│ ✅ Rebased feature/add-auth                                  │
│                                                              │
│ Step 2: Run tests                                            │
│ ✅ 47 tests passed                                           │
│ ❌ 2 tests failed                                            │
│                                                              │
│ 🔧 Fixing test failures...                                   │
│ - auth.test.ts:23: Missing mock                              │
│ - api.test.ts:45: Wrong assertion                            │
│ ✅ Tests fixed, re-running                                   │
│ ✅ All 49 tests passed                                       │
│                                                              │
│ Step 3: Coverage audit                                       │
│ Coverage: 78%                                                │
│ Target: 80%                                                  │
│                                                              │
│ Files below target:                                          │
│ - src/auth/login.ts: 65%                                     │
│ - src/api/users.ts: 72%                                      │
│                                                              │
│ ⚠️ Coverage below target. Add tests?                         │
│ → Type 'y' to add tests, 'n' to proceed                      │
│                                                              │
│ Step 4: Push branch                                          │
│ ✅ Pushed feature/add-auth to origin                         │
│                                                              │
│ Step 5: Open PR                                              │
│ ✅ PR #42 created                                            │
│ Title: Add authentication system                             │
│ Branch: feature/add-auth → main                              │
│                                                              │
│ Review URL: https://github.com/owner/repo/pull/42            │
└─────────────────────────────────────────────────────────────┘

Ship workflow complete. PR ready for review.

Test framework bootstrap

If no test framework exists, /ship creates one:

No test framework detected.

Creating test infrastructure:
- jest.config.js
- tests/setup.ts
- tests/example.test.ts

✅ Test framework initialized
✅ Running example test: PASS

Add your tests to tests/ directory.

Coverage thresholds

Threshold Behavior
< 70% BLOCK: Cannot ship
70-80% WARN: Prompt to add tests
> 80% PASS: Proceed to PR
> 90% EXCELLENT: No warnings

Force push with lease

Safe force push that checks remote state:

git push --force-with-lease origin feature/add-auth

If remote has commits you don’t have, push fails (prevents overwriting others’ work).

/land-and-deploy — Merge → Deploy

What it does

  1. Merge PR — Squash merge to main
  2. Wait for CI — Monitor CI status, block on failure
  3. Deploy — Platform-specific deployment
  4. Verify production — Health check, smoke test

Usage

/land-and-deploy

Output:

Running /land-and-deploy workflow...

┌─────────────────────────────────────────────────────────────┐
│ LAND AND DEPLOY                                              │
├─────────────────────────────────────────────────────────────┤
│ Step 1: Merge PR                                             │
│ ✅ PR #42 approved                                           │
│ ✅ Squash merged to main                                     │
│ Commit: Add authentication system (#42)                      │
│                                                              │
│ Step 2: Wait for CI                                          │
│ Monitoring CI status...                                      │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100%                        │
│                                                              │
│ ✅ CI passed (3m 24s)                                        │
│ - lint: PASS                                                 │
│ - test: PASS                                                 │
│ - build: PASS                                                │
│ - typecheck: PASS                                            │
│                                                              │
│ Step 3: Deploy                                               │
│ Platform: Vercel                                             │
│                                                              │
│ Deploying...                                                 │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100%                        │
│                                                              │
│ ✅ Deployed to production                                    │
│ URL: https://myapp.com                                       │
│ Deployment ID: dpl_abc123                                    │
│                                                              │
│ Step 4: Verify production                                    │
│ ✅ Health check: 200 OK                                      │
│ ✅ Smoke test: Login works                                   │
│ ✅ Response time: 124ms                                      │
│                                                              │
│ Deploy complete at 2026-04-07 14:32:05                       │
└─────────────────────────────────────────────────────────────┘

Deploy successful. Monitoring active.
Run /canary to check post-deploy health.

Platform detection

Platform Deploy command
Vercel vercel --prod
Netlify netlify deploy --prod
AWS Amplify amplify push
Railway railway up
Fly.io fly deploy
Custom .deploy.sh script

CI timeout

Default: 15 minutes. Configure via .gstack/config.yml:

ci:
  timeout: 20m
  required_checks:
    - lint
    - test
    - build

Smoke tests

Default smoke test checks:

  • Health endpoint (/health or /api/health)
  • Homepage loads (200 OK)
  • Critical user flow (login, if auth)

/canary — Post-Deploy Monitoring

What it monitors

  1. Console errors — Browser console errors from deployed site
  2. Performance regression — Page load time vs baseline
  3. Error rates — API error rate from logs
  4. User-facing issues — Key flows still work

Usage

/canary

Output:

Running canary monitoring for myapp.com...

┌─────────────────────────────────────────────────────────────┐
│ CANARY MONITORING                                             │
├─────────────────────────────────────────────────────────────┤
│ Duration: 5 minutes                                           │
│                                                              │
│ 📊 Console Errors                                             │
│ ✅ 0 errors detected                                          │
│                                                              │
│ 📊 Performance                                                │
│ Homepage: 124ms (baseline: 120ms)                            │
│ Dashboard: 156ms (baseline: 150ms)                           │
│ ✅ No regression (>10% threshold)                             │
│                                                              │
│ 📊 API Error Rate                                             │
│ ✅ 0.1% (target: <1%)                                         │
│                                                              │
│ 📊 User Flows                                                │
│ ✅ Login: Works                                               │
│ ✅ Dashboard: Renders                                         │
│ ✅ API calls: Respond                                         │
│                                                              │
│ ─────────────────────────────────────────────────────────────│
│ CANARY STATUS: HEALTHY                                        │
│                                                              │
│ All metrics within thresholds.                                │
│ Production is stable.                                         │
└─────────────────────────────────────────────────────────────┘

Canary passed. Deployment confirmed healthy.
Run /benchmark to update performance baseline.

Thresholds

Metric Healthy Warning Critical
Console errors 0 1-5 >5
Performance regression <10% 10-20% >20%
API error rate <1% 1-5% >5%

Auto-rollback

If canary detects critical issues:

🔴 CRITICAL: Performance regression 35%

Homepage: 162ms (baseline: 120ms)
Error rate: 12%

Initiating rollback...

┌────────────────────────────────────────────┐
│ ROLLBACK                                    │
├────────────────────────────────────────────┤
│ Previous deployment: dpl_prev456           │
│ Current deployment: dpl_abc123              │
│                                              │
│ ✅ Rolled back to dpl_prev456               │
│ ✅ Production restored                       │
│                                              │
│ Investigate failure before redeploying.     │
└────────────────────────────────────────────┘

/benchmark — Performance Baseline

What it tracks

  • Page load times
  • Core Web Vitals
  • API response times
  • Bundle size

Usage

/benchmark

Output:

Running performance benchmark...

┌─────────────────────────────────────────────────────────────┐
│ PERFORMANCE BENCHMARK                                         │
├─────────────────────────────────────────────────────────────┤
│ Page: Homepage                                                │
│ ─────────────────────────────────────────────────────────────│
│ Load Time:         124ms                                      │
│ First Contentful Paint: 89ms                                  │
│ Largest Contentful Paint: 124ms                               │
│ Time to Interactive: 156ms                                    │
│ Cumulative Layout Shift: 0.02                                 │
│                                                              │
│ Page: Dashboard                                               │
│ ─────────────────────────────────────────────────────────────│
│ Load Time:         156ms                                      │
│ First Contentful Paint: 120ms                                 │
│ Largest Contentful Paint: 156ms                               │
│ Time to Interactive: 180ms                                    │
│ Cumulative Layout Shift: 0.01                                 │
│                                                              │
│ Bundle Size                                                   │
│ ─────────────────────────────────────────────────────────────│
│ main.js: 45KB                                                 │
│ vendor.js: 120KB                                              │
│ CSS: 28KB                                                     │
│ Total: 193KB                                                  │
│                                                              │
│ ─────────────────────────────────────────────────────────────│
│ COMPARISON                                                    │
│ ─────────────────────────────────────────────────────────────│
│ Previous baseline: 2026-04-01                                 │
│                                                              │
│ Homepage load: 124ms vs 120ms (+4ms, +3.3%)                  │
│ Dashboard load: 156ms vs 150ms (+6ms, +4%)                   │
│ Bundle size: 193KB vs 190KB (+3KB, +1.6%)                    │
│                                                              │
│ ✅ All within 10% threshold                                   │
│                                                              │
│ Baseline updated to 2026-04-07                                │
└─────────────────────────────────────────────────────────────┘

Benchmark complete. Baseline saved.

Before/after comparison

When run after a release:

/benchmark --compare

Shows delta from previous baseline, highlights regressions.

/setup-deploy — One-Time Configuration

What it does

Detects your deployment platform and creates config.

Usage

/setup-deploy

Output:

Detecting deployment platform...

┌─────────────────────────────────────────────────────────────┐
│ DEPLOY SETUP                                                 │
├─────────────────────────────────────────────────────────────┤
│ Detected: Vercel                                              │
│                                                              │
│ Checking requirements:                                        │
│ ✅ vercel CLI installed                                       │
│ ✅ Project linked                                             │
│ ✅ Production branch: main                                    │
│                                                              │
│ Configuration created:                                        │
│ .gstack/deploy.yml                                            │
│                                                              │
│ platform: vercel                                              │
│ branch: main                                                  │
│ health_check: /api/health                                     │
│ smoke_tests:                                                  │
│   - login                                                     │
│   - dashboard                                                 │
│                                                              │
│ ✅ Deploy setup complete                                      │
│                                                              │
│ Use /land-and-deploy to deploy after PR merge.               │
└─────────────────────────────────────────────────────────────┘

Full Release Flow Example

Complete workflow

# 1. Ship: Push code, create PR
/ship

# 2. Human approves PR on GitHub

# 3. Land and deploy: Merge → CI → Deploy
/land-and-deploy

# 4. Canary: Monitor for 5 minutes
/canary

# 5. Benchmark: Update performance baseline
/benchmark

# 6. Document release (next tutorial)
/document-release

Timeline

14:00 /ship complete, PR #42 open
14:15 Human approves PR
14:16 /land-and-deploy starts
14:19 CI passed (3m)
14:21 Deploy complete (2m)
14:21 /canary starts
14:26 /canary passed
14:27 /benchmark updated
14:28 /document-release

Total: 28 minutes from ship to production

Skill Quick Reference

Command Purpose Duration
/ship Push + PR 2-5m
/land-and-deploy Merge → Deploy 5-10m
/canary Post-deploy monitoring 5m
/benchmark Performance baseline 1m
/setup-deploy One-time platform config 1m
/ship --skip-tests Emergency ship 30s

Summary

Release engineering in gstack provides:

  1. Complete CI/CD pipeline — Ship → Deploy → Monitor → Benchmark
  2. Test bootstrap — Creates framework if missing
  3. Coverage audit — Every ship checks coverage
  4. Platform detection — Auto-detects Vercel, Netlify, etc.
  5. Auto-rollback — Canary triggers rollback on critical issues

Key takeaways

  • ✅ Run /ship to create PR
  • ✅ Approve PR manually (human gate)
  • ✅ Run /land-and-deploy after approval
  • ✅ Run /canary for 5-minute monitoring
  • ✅ Run /benchmark to update baseline

Series navigation: