Skip to content

Commit 25964ab

Browse files
committed
fix(ci): pick the CodeDeploy action when the app Deploy stage has sidecar actions
The app pipeline's Deploy stage can now also run a CodeBuild image deploy for the sandbox worker host. The cutover wait required exactly one Deploy action, so Trigger.dev promotion failed whenever that action was present. Select the CodeDeployToECS action by provider; everything after it is unchanged.
1 parent 511a064 commit 25964ab

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎.github/scripts/wait-for-ecs-cutover.sh‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,15 @@ while [ -z "$DEPLOYMENT_ID" ] || [ "$DEPLOYMENT_ID" = 'None' ]; do
9292
DEPLOYMENT_ID=$(printf '%s\n' "$deploy_actions" | DEPLOY_STATE="$deploy_state" EXECUTION_ID="$EXECUTION_ID" python3 -c '
9393
import json, os, re, sys
9494
state = json.loads(os.environ["DEPLOY_STATE"])
95-
actions = json.load(sys.stdin)
95+
# The Deploy stage can also run sidecar actions (e.g. a CodeBuild image deploy); only the
96+
# CodeDeploy blue/green action carries the ECS cutover.
97+
actions = [a for a in json.load(sys.stdin)
98+
if a.get("input", {}).get("actionTypeId", {}).get("provider") == "CodeDeployToECS"]
9699
if not state or state.get("latestExecution", {}).get("pipelineExecutionId") != os.environ["EXECUTION_ID"] or not actions:
97100
print("")
98101
sys.exit(0)
99102
if len({a["actionName"] for a in actions}) != 1:
100-
raise SystemExit("ERROR: expected one Deploy action in the app pipeline")
103+
raise SystemExit("ERROR: expected one CodeDeploy ECS action in the app pipeline Deploy stage")
101104
latest = max(actions, key=lambda a: a["startTime"])
102105
matches = [a["latestExecution"] for a in state.get("actionStates", [])
103106
if a["actionName"] == latest["actionName"]

0 commit comments

Comments
 (0)