File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -123,11 +123,19 @@ callerIdentityJson=$(${AWS_CLI_BIN} sts get-caller-identity)
123123ACCOUNT_ID=$( echo " ${callerIdentityJson} " | jq -r " .Account" )
124124MY_IAM_ARN=$( echo " ${callerIdentityJson} " | jq -r " .Arn" )
125125
126- # Check whether the AWS CLI v1.19.28/v2.1.30 or later exists
126+ # Check task existence
127127describedTaskJson=$( ${AWS_CLI_BIN} ecs describe-tasks \
128128 --cluster " ${CLUSTER_NAME} " \
129129 --tasks " ${TASK_ID} " \
130130 --output json)
131+ existTask=$( echo " ${describedTaskJson} " | jq -r " .tasks[0].taskDefinitionArn" )
132+ if [[ " x${existTask} " = " xnull" ]]; then
133+ printf " ${COLOR_RED} Pre-flight check failed: The specified ECS task does not exist.\n\
134+ Make sure the parameters you have specified for cluster \" ${CLUSTER_NAME} \" and task \" ${TASK_ID} \" are both valid.\n"
135+ exit 1
136+ fi
137+
138+ # Check whether the AWS CLI v1.19.28/v2.1.30 or later exists
131139executeCommandEnabled=$( echo " ${describedTaskJson} " | jq -r " .tasks[0].enableExecuteCommand" )
132140if [[ " x${executeCommandEnabled} " = " xnull" ]]; then
133141 printf " ${COLOR_RED} Pre-flight check failed: ECS Exec requires the AWS CLI v1.19.28/v2.1.30 or later.\n\
You can’t perform that action at this time.
0 commit comments