Closed kedarparallel closed 5 years ago
Running bash script in debug mode helped me solve issue.
If you just run
eval $(aws ecr get-login --no-include-email --region ${aws_ecr_region})
for some reason between password and ecr name it adds 3 spaces while you actually need ==
So I replaced it with following code:
cmd=$(aws ecr get-login --no-include-email --region ${aws_ecr_region})
spaces=" "
equals="=="
eval "${cmd/$spaces/$equals}"
Expected behavior
eval $(aws ecr get-login --no-include-email --region ${aws_ecr_region})
TOKEN=$(aws ecr get-authorization-token --output text --query 'authorizationData[].authorizationToken')
docker login -u AWS -p ${TOKEN} http://${aws_container_registry_name}
echo "$(aws ecr get-authorization-token --region ${aws_ecr_region} --output text --query 'authorizationData[].authorizationToken' | base64 -d | cut -d: -f2) | docker login -u AWS https://${aws_container_registry_name} --password-stdin"
Actual behavior
All 3 of the options mentioned above give error:
However, if I simply copy paste these commands(after substituting variables) and manually execute, all of them work fine.
Information
Steps to reproduce the behavior
eval $(aws ecr get-login --no-include-email --region ${aws_ecr_region}) from within script
or 1 or 2 mentioned in 'Expected Behaviour'