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 @@ -124,11 +124,19 @@ callerIdentityJson=$(${AWS_CLI_BIN} sts get-caller-identity)
124124ACCOUNT_ID=$( echo " ${callerIdentityJson} " | jq -r " .Account" )
125125MY_IAM_ARN=$( echo " ${callerIdentityJson} " | jq -r " .Arn" )
126126
127- # Check whether the AWS CLI v1.19.28/v2.1.30 or later exists
127+ # Check task existence
128128describedTaskJson=$( ${AWS_CLI_BIN} ecs describe-tasks \
129129 --cluster " ${CLUSTER_NAME} " \
130130 --tasks " ${TASK_ID} " \
131131 --output json)
132+ existTask=$( echo " ${describedTaskJson} " | jq -r " .tasks[0].taskDefinitionArn" )
133+ if [[ " x${existTask} " = " xnull" ]]; then
134+ printf " ${COLOR_RED} Pre-flight check failed: The specified ECS task does not exist.\n\
135+ Make sure the parameters you have specified for cluster \" ${CLUSTER_NAME} \" and task \" ${TASK_ID} \" are both valid.\n"
136+ exit 1
137+ fi
138+
139+ # Check whether the AWS CLI v1.19.28/v2.1.30 or later exists
132140executeCommandEnabled=$( echo " ${describedTaskJson} " | jq -r " .tasks[0].enableExecuteCommand" )
133141if [[ " x${executeCommandEnabled} " = " xnull" ]]; then
134142 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