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)
123
123
ACCOUNT_ID=$( echo " ${callerIdentityJson} " | jq -r " .Account" )
124
124
MY_IAM_ARN=$( echo " ${callerIdentityJson} " | jq -r " .Arn" )
125
125
126
- # Check whether the AWS CLI v1.19.28/v2.1.30 or later exists
126
+ # Check task existence
127
127
describedTaskJson=$( ${AWS_CLI_BIN} ecs describe-tasks \
128
128
--cluster " ${CLUSTER_NAME} " \
129
129
--tasks " ${TASK_ID} " \
130
130
--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
131
139
executeCommandEnabled=$( echo " ${describedTaskJson} " | jq -r " .tasks[0].enableExecuteCommand" )
132
140
if [[ " x${executeCommandEnabled} " = " xnull" ]]; then
133
141
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