@@ -4,7 +4,7 @@ VERSION="0.1.0"
4
4
VERBOSE=false
5
5
AWS_CLI=$( which aws)
6
6
AWS_ECS=" $AWS_CLI --output json ecs"
7
- AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:= " eu-west-1" }
7
+ AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:- eu-west-1}
8
8
AWS_ASSUME_ROLE=true
9
9
10
10
function usage() {
@@ -22,7 +22,7 @@ Required arguments:
22
22
Optional arguments:
23
23
-k | --aws-access-key AWS Access Key ID. May also be set as environment variable AWS_ACCESS_KEY_ID
24
24
-s | --aws-secret-key AWS Secret Access Key. May also be set as environment variable AWS_SECRET_ACCESS_KEY
25
- -r | --region AWS Region Name. May also be set as environment variable AWS_DEFAULT_REGION or use the default ` eu-west-1`
25
+ -r | --region AWS Region Name. May also be set as environment variable AWS_DEFAULT_REGION or use the default eu-west-1
26
26
-v | --verbose Display debugging information (basically each command)
27
27
28
28
Requirements:
@@ -84,6 +84,16 @@ function getServiceName() {
84
84
--query ' Stacks[0].Outputs[?OutputKey==`Service`].OutputValue' \
85
85
--output text --region ${AWS_DEFAULT_REGION}
86
86
)
87
+ if [ $ECS_SERVICE_NAME == $ECS_CLUSTER_NAME ]; then
88
+ echo " Long ARN bug found: using ServiceArn output to get Service name" ;
89
+ temp_servicename=$( $AWS_CLI cloudformation describe-stacks \
90
+ --stack-name ${ECS_SERVICE_STACK} \
91
+ --query ' Stacks[0].Outputs[?OutputKey==`ServiceArn`].OutputValue' \
92
+ --output text --region ${AWS_DEFAULT_REGION}
93
+ )
94
+ echo $ECS_SERVICE_NAME
95
+ export ECS_SERVICE_NAME=${temp_servicename##*/ }
96
+ fi
87
97
if [ -z $ECS_SERVICE_NAME ]; then
88
98
echo " Could not find the service under the '$ECS_SERVICE_STACK ' stack"
89
99
exit 10
0 commit comments