improvement(ci): ensure atomicity in trigger deploys, improve overall ci organization#1477
Merged
Merged
Conversation
added 3 commits
September 27, 2025 14:04
…ai/chat/[identifier]
…ses sim.ai/chat/[identifier]" This reverts commit c68c052.
Contributor
There was a problem hiding this comment.
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.ymlandbuild.ymlinto a unifiedimages.ymlworkflow - 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
8 files reviewed, 1 comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ensure atomicity in trigger deploys, improve overall ci organization
Type of Change
Testing
N/A
Checklist