File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ while [[ $# -gt 0 ]]; do
4040 task_ip=" $2 "
4141 shift 2
4242 ;;
43+ --exit-without-login|-x)
44+ exit_without_login=true
45+ shift
46+ ;;
4347 -h|--help)
4448 usage
4549 exit 0
6468
6569cluster_name=" mavis-$env "
6670
71+ aws sts get-caller-identity & > /dev/null
72+ if [[ $? -ne 0 ]]; then
73+ if [[ -z " $exit_without_login " ]]; then
74+ aws sso login
75+ if [[ $? -ne 0 ]]; then
76+ echo " Error: AWS CLI SSO login failed. Please log in to your AWS account."
77+ exit 1
78+ fi
79+ else
80+ echo " Error: AWS SSO login required. Please log in to your AWS account using 'aws sso login'."
81+ exit 1
82+ fi
83+ fi
84+
6785if [ -n " $task_id " ]; then
6886 task_description=$( aws ecs describe-tasks --region " $region " --cluster " $cluster_name " --task " $task_id " )
6987 if [ -z " $task_description " ] || echo " $task_description " | jq -e ' .tasks | length == 0' > /dev/null; then
You can’t perform that action at this time.
0 commit comments