feat(ci): promote Trigger.dev tasks in lockstep with the ECS traffic cutover#5725
feat(ci): promote Trigger.dev tasks in lockstep with the ECS traffic cutover#5725TheodoreSpeaks wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview A new Reviewed by Cursor Bugbot for commit f7135b0. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR coordinates Trigger.dev task promotion with the ECS traffic cutover. The main changes are:
Confidence Score: 5/5The latest fixes look safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(ci): widen promote-trigger job timeo..." | Re-trigger Greptile |
…erify all ECS targets
|
@greptile review |
|
@cursor review |
| uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # v6 | ||
| 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 }} |
There was a problem hiding this comment.
AWS creds expire before poll
High Severity
promote-trigger assumes the deploy role with the default ~60-minute session and never sets role-duration-seconds, while wait-for-ecs-cutover.sh is built to poll for up to 70 minutes (the prod bake-queue case). After the session expires, AWS calls fail; those errors are swallowed, so the script keeps retrying until timeout and never promotes. The long-wait path this change was written for leaves the app cut over while Trigger.dev stays on the old version.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit f7135b0. Configure here.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f7135b0. Configure here.
| log "No matching post-retag pipeline execution yet; retry in ${POLL_INTERVAL}s (remaining $(remaining)s)" | ||
| sleep "$POLL_INTERVAL" | ||
| fi | ||
| done |
There was a problem hiding this comment.
Same digest blocks task promotion
Medium Severity
Phase A requires a CodePipeline execution for the app digest with startTime at/after retag_epoch. That rejects the historical same-digest run this filter was added for, but retagging latest/staging to a digest it already points at is often a no-op for ECR (no new EventBridge/pipeline). The poll then never finds a post-retag execution and times out, so the skip-promoted Trigger.dev version from deploy-trigger is never promoted—especially on re-runs after promote-images already moved the tag, or any push that reuses the app image digest (Trigger tasks live in background/ and are not in the final app image).
Additional Locations (1)
Reviewed by Cursor Bugbot for commit f7135b0. Configure here.


Summary
--skip-promotionso new task runs keep executing the old version until we promote.promote-trigger-*job polls CodeDeploy (AllowTraffic) and then runstrigger promote, so tasks and app cut over in lockstep instead of tasks flipping ~4–50 min early (the prod bake queue).build-amd64publishes it as an artifact) → CodePipeline execution → CodeDeploy deployment id →AllowTraffic. ECR deploy tags are floating, so the digest is the only durable key.promote-images.promoted: when the stale-run guard skips the image retag, tasks correctly stay on the old version. If the app deploy fails or never cuts over, promote never fires and the job fails visibly..github/scripts/wait-for-ecs-cutover.shdoes the poll; verified end-to-end against real staging deploys (digest →d-…→AllowTraffic).Prerequisites before this runs on staging/prod
STAGING_AWS_ROLE_TO_ASSUME,AWS_ROLE_TO_ASSUME), which are managed outside the repo:codepipeline:ListPipelineExecutions/GetPipelineExecution/ListActionExecutions,codedeploy:GetDeployment/ListDeploymentTargets/GetDeploymentTarget.TRIGGER_ACCESS_TOKENrepo secret (a Trigger.dev PAT; spans all environments). Then disable the Trigger.dev git integration for staging/prod.Type of Change
Testing
wait-for-ecs-cutover.shagainst real completed staging deployments: correctly resolved digest → pipeline execution → CodeDeploy deployment →AllowTraffic(exit 0), and timed out cleanly on an unmatched digest (exit 1).actionlintclean (only pre-existing custom-runner-label warnings);bun run lintandbun run check:api-validation:strictpass; YAML validated.Checklist