Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

ensure atomicity in trigger deploys, improve overall ci organization

Type of Change

  • Other: Performance

Testing

N/A

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Sep 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Sep 28, 2025 5:07am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 28, 2025 5:07am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR significantly improves CI organization and deployment atomicity by restructuring GitHub Actions workflows. The key improvements include:

  • Atomicity Enhancement: Split Trigger.dev deployment into deploy → migrate → promote phases, preventing incomplete deployments
  • Workflow Organization: Consolidated duplicate build logic from build-ecr.yml and build.yml into a unified images.yml workflow
  • Modular Design: Extracted reusable workflows (test-build.yml, migrations.yml) that can be called independently
  • Proper Dependencies: Established clear sequential execution (test-build → build-images → trigger-deploy → migrations → trigger-promote → process-docs)
  • Environment Handling: Maintained proper branch-based logic for staging vs production deployments

The changes ensure ECS deployments and database migrations complete successfully before promoting Trigger.dev deployments, eliminating race conditions that could lead to inconsistent application state.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it improves deployment reliability and workflow organization
  • Score reflects excellent architectural improvements that enhance deployment reliability. The changes are well-structured with proper dependency chains, maintain existing functionality while improving atomicity, and follow GitHub Actions best practices.
  • No files require special attention - all changes improve the existing CI architecture

Important Files Changed

File Analysis

Filename        Score        Overview
.github/workflows/ci.yml 5/5 Reorganized CI workflow with proper dependency chain - test-build → build-images → trigger-deploy → migrations → trigger-promote → process-docs
.github/workflows/images.yml 5/5 New unified image building workflow supporting both ECR and GHCR with conditional logic for staging vs main branches
.github/workflows/trigger-deploy.yml 5/5 New workflow for Trigger.dev deployment with --skip-promotion flag to ensure atomicity with ECS deployments
.github/workflows/trigger-promote.yml 5/5 New workflow for Trigger.dev promotion that runs after migrations complete, completing the atomic deployment

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub Actions
    participant TestBuild as test-build.yml
    participant Images as images.yml  
    participant ECR as Amazon ECR
    participant GHCR as GitHub Container Registry
    participant TriggerDeploy as trigger-deploy.yml
    participant TriggerDev as Trigger.dev
    participant Migrations as migrations.yml
    participant Database as Database
    participant TriggerPromote as trigger-promote.yml
    participant ProcessDocs as docs-embeddings.yml

    GitHub->>TestBuild: 1. Run tests and build
    TestBuild-->>GitHub: Tests pass, build successful
    
    GitHub->>Images: 2. Build and push images
    Images->>ECR: Push ECR images (staging/latest tags)
    alt if main branch
        Images->>GHCR: Push GHCR images (amd64 + arm64)
        Images->>GHCR: Create multi-arch manifests
    end
    Images-->>GitHub: Images built and pushed
    
    GitHub->>TriggerDeploy: 3. Deploy with --skip-promotion
    TriggerDeploy->>TriggerDev: Deploy but skip promotion
    TriggerDev-->>TriggerDeploy: Deployment ready (not promoted)
    TriggerDeploy-->>GitHub: Trigger.dev deployed, awaiting promotion
    
    GitHub->>Migrations: 4. Apply database migrations
    Migrations->>Database: Run migrations
    Database-->>Migrations: Migrations applied
    Migrations-->>GitHub: Database ready
    
    GitHub->>TriggerPromote: 5. Promote Trigger.dev deployment
    TriggerPromote->>TriggerDev: Promote latest deployment
    TriggerDev-->>TriggerPromote: Deployment promoted
    TriggerPromote-->>GitHub: Trigger.dev live
    
    GitHub->>ProcessDocs: 6. Process documentation embeddings
    ProcessDocs-->>GitHub: Documentation processed
Loading

8 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 38dd2d0 into staging Sep 28, 2025
10 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/atomic-deploys-trigger branch September 28, 2025 05:11
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