improvement(ci): trigger.dev pushes#1506
Conversation
There was a problem hiding this comment.
Greptile Overview
Summary
This PR significantly refactors the CI workflow architecture by inlining Docker build jobs directly into the main `ci.yml` file and fundamentally changing the execution order. Previously, the workflow followed a sequential pattern: test → build images → deploy trigger.dev → migrations → docs. The new approach implements a more parallel execution model: test → (trigger.dev deployment + image builds in parallel) → create manifests + docs.The key architectural changes include moving the Trigger.dev deployment to execute immediately after tests pass, running in parallel with Docker image builds rather than waiting for them to complete. The image building logic that was previously abstracted in a separate images.yml workflow file has been duplicated and inlined directly into ci.yml, with explicit AMD64 and ARM64 build jobs that can run simultaneously. Multi-architecture manifest creation is now handled as a separate job that combines the built images.
The workflow now removes the database migrations job entirely, suggesting that migration handling has been moved elsewhere in the deployment process or is no longer coordinated through the main CI pipeline. This change appears to optimize for faster feedback loops and parallel execution, allowing Trigger.dev functions to deploy as soon as tests pass without waiting for containerized services to be built and pushed.
PR Description Notes:
- The PR template is completely unfilled - all sections (Summary, Type of Change, Testing, Checklist) contain only placeholder text
- No actual description of changes, testing approach, or issue reference is provided
- All checklist items remain unchecked
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
| .github/workflows/ci.yml | 2/5 | Major CI workflow refactor that inlines image builds, reorders deployment timing, and removes migrations job coordination |
Confidence score: 2/5
- This PR introduces significant deployment timing risks and removes critical migration coordination
- Score reflects major architectural changes in CI pipeline that could cause deployment failures and missing database migrations
- Pay close attention to the deployment timing changes and verify that migrations are properly handled elsewhere
Sequence Diagram
sequenceDiagram
participant User
participant GitHub
participant CI as "CI Workflow"
participant TestBuild as "Test & Build Job"
participant TriggerDeploy as "Trigger.dev Deploy"
participant BuildAMD64 as "AMD64 Build Job"
participant BuildARM64 as "ARM64 Build Job (main only)"
participant ECR as "Amazon ECR"
participant GHCR as "GitHub Container Registry"
participant Manifests as "Manifest Creation"
participant ProcessDocs as "Process Docs"
User->>GitHub: "Push to main/staging or create PR"
GitHub->>CI: "Trigger CI workflow"
CI->>TestBuild: "Start test-build job"
TestBuild->>TestBuild: "Run tests and build"
TestBuild->>CI: "Complete successfully"
par Parallel execution after test-build
CI->>TriggerDeploy: "Deploy to Trigger.dev (push only)"
TriggerDeploy->>TriggerDeploy: "Execute deployment"
TriggerDeploy->>CI: "Deployment complete"
and
CI->>BuildAMD64: "Build AMD64 images (push only)"
BuildAMD64->>BuildAMD64: "Configure AWS & Docker"
BuildAMD64->>BuildAMD64: "Generate tags for ECR + GHCR"
BuildAMD64->>ECR: "Push AMD64 images (staging/latest)"
alt Main branch only
BuildAMD64->>GHCR: "Push AMD64 images with arch tags"
end
BuildAMD64->>CI: "AMD64 build complete"
and
alt Main branch only
CI->>BuildARM64: "Build ARM64 for GHCR"
BuildARM64->>BuildARM64: "Build ARM64 images"
BuildARM64->>GHCR: "Push ARM64 images with arch tags"
BuildARM64->>CI: "ARM64 build complete"
end
end
alt Main branch only
CI->>Manifests: "Create multi-arch manifests"
Manifests->>GHCR: "Create latest manifest (AMD64 + ARM64)"
Manifests->>GHCR: "Create SHA manifest (AMD64 + ARM64)"
Manifests->>CI: "Manifests created"
end
CI->>ProcessDocs: "Process documentation embeddings"
ProcessDocs->>ProcessDocs: "Update docs embeddings"
ProcessDocs->>CI: "Docs processing complete"
CI->>GitHub: "Workflow complete"
1 file reviewed, 1 comment
| build-amd64: | ||
| name: Build AMD64 | ||
| needs: test-build | ||
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| id-token: write | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - dockerfile: ./docker/app.Dockerfile | ||
| ghcr_image: ghcr.io/simstudioai/simstudio | ||
| ecr_repo_secret: ECR_APP | ||
| - dockerfile: ./docker/db.Dockerfile | ||
| ghcr_image: ghcr.io/simstudioai/migrations | ||
| ecr_repo_secret: ECR_MIGRATIONS | ||
| - dockerfile: ./docker/realtime.Dockerfile | ||
| ghcr_image: ghcr.io/simstudioai/realtime | ||
| ecr_repo_secret: ECR_REALTIME | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # Deploy Trigger.dev (after builds complete) | ||
| trigger-deploy: | ||
| name: Deploy Trigger.dev | ||
| needs: build-images | ||
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') | ||
| uses: ./.github/workflows/trigger-deploy.yml | ||
| secrets: inherit | ||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ github.ref == 'refs/heads/main' && secrets.AWS_ROLE_TO_ASSUME || secrets.STAGING_AWS_ROLE_TO_ASSUME }} | ||
| aws-region: ${{ github.ref == 'refs/heads/main' && secrets.AWS_REGION || secrets.STAGING_AWS_REGION }} | ||
|
|
||
| - name: Login to Amazon ECR | ||
| id: login-ecr | ||
| uses: aws-actions/amazon-ecr-login@v2 | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Login to GHCR | ||
| if: github.ref == 'refs/heads/main' | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.repository_owner }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: useblacksmith/setup-docker-builder@v1 | ||
|
|
||
| - name: Generate tags | ||
| id: meta | ||
| run: | | ||
| ECR_REGISTRY="${{ steps.login-ecr.outputs.registry }}" | ||
| ECR_REPO="${{ secrets[matrix.ecr_repo_secret] }}" | ||
| GHCR_IMAGE="${{ matrix.ghcr_image }}" | ||
|
|
||
| # ECR tags (always build for ECR) | ||
| if [ "${{ github.ref }}" = "refs/heads/main" ]; then | ||
| ECR_TAG="latest" | ||
| else | ||
| ECR_TAG="staging" | ||
| fi | ||
| ECR_IMAGE="${ECR_REGISTRY}/${ECR_REPO}:${ECR_TAG}" | ||
|
|
||
| # Build tags list | ||
| TAGS="${ECR_IMAGE}" | ||
|
|
||
| # Add GHCR tags only for main branch | ||
| if [ "${{ github.ref }}" = "refs/heads/main" ]; then | ||
| GHCR_AMD64="${GHCR_IMAGE}:latest-amd64" | ||
| GHCR_SHA="${GHCR_IMAGE}:${{ github.sha }}-amd64" | ||
| TAGS="${TAGS},$GHCR_AMD64,$GHCR_SHA" | ||
| fi | ||
|
|
||
| echo "tags=${TAGS}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build and push images | ||
| uses: useblacksmith/build-push-action@v2 | ||
| with: | ||
| context: . | ||
| file: ${{ matrix.dockerfile }} | ||
| platforms: linux/amd64 | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| provenance: false | ||
| sbom: false |
There was a problem hiding this comment.
style: The entire build-amd64 job logic was duplicated from images.yml rather than kept in a reusable workflow. This creates maintenance overhead and potential for drift between implementations.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/ci.yml
Line: 28:117
Comment:
style: The entire build-amd64 job logic was duplicated from images.yml rather than kept in a reusable workflow. This creates maintenance overhead and potential for drift between implementations.
How can I resolve this? If you propose a fix, please make it concise.
Summary
ci workflow for trigger
Type of Change
Testing
n/a
Checklist