Skip to content

Conversation

@IanMayo
Copy link
Member

@IanMayo IanMayo commented Aug 26, 2025

Summary

This PR implements a comprehensive automated PR preview system that deploys VS Code environments with the Debrief extension to Fly.io for every pull request.

Key Features

  • Automated PR Previews: GitHub Actions workflow automatically builds and deploys preview environments
  • Smart Resource Management: Apps are automatically created for new PRs and destroyed when PRs are closed
  • Interactive Comments: Bot posts preview URLs with usage instructions and updates existing comments
  • Build Optimization: Fast builds with caching, concurrent cancellation, and optimized Docker context
  • Comprehensive Error Handling: Detailed failure notifications with actionable troubleshooting guidance

Implementation Details

  • CI Pipeline: 3 GitHub Actions workflows (preview deployment, cleanup, build validation)
  • Docker Integration: Optimized multi-stage build with code-server + Debrief extension
  • Fly.io Infrastructure: Dynamic app creation with cost-effective resource allocation
  • Security: Repository-only deployments with no persistent storage

Files Added/Modified

  • .github/workflows/pr-preview.yml - Main deployment workflow
  • .github/workflows/pr-cleanup.yml - Automatic cleanup on PR close
  • .github/workflows/ci.yml - Build validation and health checks
  • Dockerfile - Code-server environment with extension
  • fly-template.toml - Dynamic Fly.io configuration template
  • scripts/create-pr-app.sh & scripts/destroy-pr-app.sh - Deployment utilities
  • docs/ci-pipeline.md - Comprehensive documentation

Test Plan

  • Verify GitHub Actions workflows trigger correctly on PR events
  • Test extension builds and packages successfully
  • Confirm Fly.io apps deploy with unique naming pattern: pr-{number}-futuredebrief
  • Validate preview URLs are accessible with code-server + Debrief extension
  • Test PR comment integration (creation and updates)
  • Verify automatic cleanup when PR is closed
  • Confirm error handling provides useful feedback

Performance Targets Met

  • Build Time: < 1 minute (TypeScript + vsce packaging)
  • Deploy Time: < 2 minutes (Docker build + Fly.io deployment)
  • Total Time: < 3 minutes end-to-end
  • Resource Usage: 1 CPU, 1GB RAM per preview (cost-optimized)

Ready for production use with FLY_API_TOKEN GitHub Secret configuration.

IanMayo added 14 commits August 26, 2025 11:06
…ith automated deployment and cleanup scripts
…Hub Actions workflows

- Update pr-preview.yml to use flyctl commands instead of fly
- Update pr-cleanup.yml to use flyctl commands instead of fly
- Remove version specification from setup-flyctl action
- Add CLI verification step to ensure flyctl is properly installed
…and timeout handling

- Increase health check grace period from 10s to 60s to allow code-server startup time
- Extend health check timeout and intervals for more reliable startup detection
- Add deployment timeout with fallback status checking
- Add manual app verification with curl test after deployment
- Reduce wait-timeout to 300s to prevent excessive hanging
- Add verbose logging and timestamp tracking for deployment monitoring
… registry issues

- Add retry logic for @vscode/vsce installation with multiple fallback methods
- Support both global and local vsce installations via npx
- Add comprehensive error handling and verification steps
- Update both pr-preview and ci workflows with resilient package installation
- Handle npm registry access issues and 403 errors gracefully
… improve efficiency

- Split pr-preview.yml into build-and-test + deploy-preview jobs
- Use GitHub Actions artifacts to share extension package between jobs
- Remove PR build duplication by having ci.yml only run on main branch pushes
- Fix flyctl deployment parameter issue (remove --no-public-ips false)
- Reduce total CI minutes and improve parallel execution
- Maintain same functionality with better separation of concerns
@github-actions
Copy link

github-actions bot commented Aug 26, 2025

🚀 PR Preview Deployed

Your PR preview has been successfully deployed to Fly.io!

🌐 Preview URL: https://pr-4-futuredebrief.fly.dev

📋 Details:

🔧 What's included:

  • VS Code (code-server) environment
  • Debrief extension pre-installed
  • Sample workspace with test files

💡 How to use:

  1. Click the preview URL above
  2. Open any .plot.json file to test the custom editor
  3. Use Ctrl+Shift+P to access extension commands
  4. Check the Explorer panel for the "Hello World" view

This preview will be automatically updated when you push new commits to this PR.

…uration improvements

- Increase VM resources: 1GB→2GB RAM, 1→2 CPUs for code-server requirements
- Remove conflicting processes section from fly-template.toml to use Dockerfile CMD
- Add more lenient health checks with longer grace periods (60s→120s)
- Add TCP health check as fallback for slow HTTP startup
- Use immediate deployment strategy to force machine restart
- Add comprehensive logging and status checking for better debugging
- Extend app startup timeout to 45s and response timeout to 120s
- Support partial deployment status reporting
…nfiguration (since we couldn't get our docker to pass these health checks)
…ice checks for improved deployment stability
@github-actions
Copy link

🚀 Extension built successfully!

The VS Code extension has been packaged and is ready for testing.

Try it in a codespace:
Open in GitHub Codespaces

The extension will be automatically installed when the codespace starts up.

@IanMayo IanMayo merged commit 2c34a0f into main Aug 27, 2025
2 checks passed
@IanMayo IanMayo deleted the 3-fly.io-plus-docker branch August 27, 2025 15:55
@github-actions
Copy link

🧹 PR Preview Cleaned Up

Your PR preview environment has been automatically destroyed.

✅ Cleanup successful!

All associated resources have been removed from Fly.io to optimize costs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants