File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -108,23 +108,24 @@ ATTEMPT=0
108108echo  " ⏳ Waiting up to $MAX_WAIT_MINUTES  minutes for ECS task to stop..." 
109109
110110STATUS=" " 
111+ ATTEMPT=0
111112
112113while  [[ $ATTEMPT  -lt  $MAX_ATTEMPTS  ]];  do 
114+   #  Temporarily allow command failures
113115  set  +e
114-   aws_output =$( aws ecs describe-tasks \
116+   STATUS =$( aws ecs describe-tasks \
115117    --cluster " $CLUSTER_NAME "  
116118    --tasks " $TASK_ARN "  
117119    --region " $AWS_REGION "  
118120    --query ' tasks[0].lastStatus'  
119121    --output text 2>&1 )  
120-   cmd_status =$? 
122+   STATUS_EXIT_CODE =$? 
121123  set  -e
122124
123-   if  [[ $cmd_status   -ne  0 ||  " $aws_output  " ==  * " error" *  ||  " $aws_output  " ==  * " Unable to" *  ||  -z  " $aws_output  " ;  then 
124-     echo  " ⚠️  Could not fetch ECS task status (attempt $ATTEMPT ): $aws_output  " 
125+   if  [[ $STATUS_EXIT_CODE   -ne  0 ||  " $STATUS  " ==  * " error" *  ||  " $STATUS  " ==  * " Unable to" *  ||  -z  " $STATUS  " ;  then 
126+     echo  " ⚠️  Could not fetch ECS task status (attempt $ATTEMPT ): $STATUS  " 
125127    STATUS=" " 
126128  else 
127-     STATUS=" $aws_output " 
128129    echo  " 🔁 Task status: $STATUS  (attempt $ATTEMPT )" 
129130  fi 
130131
@@ -137,7 +138,6 @@ while [[ $ATTEMPT -lt $MAX_ATTEMPTS ]]; do
137138  (( ATTEMPT++ )) 
138139done 
139140
140- 
141141if  [[ " $STATUS " !=  " STOPPED" ;  then 
142142  echo  " ❌ ECS task did not stop within $MAX_WAIT_MINUTES  minutes." >&2 
143143  exit  1
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments