Skip to content

Commit d668bb3

Browse files
committed
quick fix
1 parent 7f68c0b commit d668bb3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

AWS/prepare-build-cloud.bash

+10-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ cleanup() {
1515
sleep 50
1616
done
1717

18-
[[ "${ELASTIC_IP_ID}" != null ]] && aws_execute "ec2 release-address \
19-
--allocation-id \"${ELASTIC_IP_ID}\""
18+
if [[ "${ELASTIC_IP_ID}" != null ]]; then
19+
aws_execute "ec2 release-address \
20+
--allocation-id \"${ELASTIC_IP_ID}\""
21+
else
22+
if [[ -n "${AWS_BUILD_CLOUD_UNIQUE_LABEL}" ]]; then
23+
ELASTIC_IP="$(aws_execute -r -s "ec2 describe-addresses --filter \"Name=tag:purpose,Values=${AWS_BUILD_CLOUD_UNIQUE_LABEL}\"")"
24+
ELASTIC_IP_ID="$(echo "${ELASTIC_IP}" | jq -r '.Addresses[0].AllocationId')"
25+
aws_execute "ec2 release-address --allocation-id \"${ELASTIC_IP_ID}\""
26+
fi
27+
fi
2028

2129
[[ "${SECURITY_GROUP_ID}" != null ]] && aws_execute "ec2 delete-security-group \
2230
--group-id \"${SECURITY_GROUP_ID}\" \

0 commit comments

Comments
 (0)