As image names can be specified in AWS ECR with slashes, for example, "my-group/my-image-name" I would like to specify this information in a pipe. So it would look like:
- step:
name: Build Dockerfile and push it to ECR
script:
- docker build -t my-group/my-image-name .
- pipe: atlassian/aws-ecr-push-image:1.5.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
IMAGE_NAME: my-group/my-image-name
DEBUG: "true"
When I've tried this, the following error was thrown:
DEBUG: http://host.docker.internal:2375 "POST /v1.41/images/xxxx.dkr.ecr.xxxx.amazonaws.com/my-group/my-image-name/push?tag=latest HTTP/1.1" 200 None
INFO: {'status': 'The push refers to repository [xxxx.dkr.ecr.xxxx.amazonaws.com/my-group/my-image-name]'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '6816afbbb3be'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '16fdcefba9b2'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': 'ea44e3716f74'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '8607c8c34ac2'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': 'c9109473da10'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '16c770f32328'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '866fb7fffb5e'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '25b3fd43616d'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '957cc3cb8f33'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '31d8693e83b2'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '640439866c2f'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '5d2a276f8b89'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '058670b42da8'}
INFO: {'status': 'Preparing', 'progressDetail': {}, 'id': '9f54eef41275'}
INFO: {'status': 'Waiting', 'progressDetail': {}, 'id': '16c770f32328'}
INFO: {'status': 'Waiting', 'progressDetail': {}, 'id': '866fb7fffb5e'}
INFO: {'status': 'Waiting', 'progressDetail': {}, 'id': '25b3fd43616d'}
INFO: {'status': 'Waiting', 'progressDetail': {}, 'id': '957cc3cb8f33'}
INFO: {'status': 'Waiting', 'progressDetail': {}, 'id': '31d8693e83b2'}
INFO: {'status': 'Waiting', 'progressDetail': {}, 'id': '640439866c2f'}
INFO: {'status': 'Waiting', 'progressDetail': {}, 'id': '5d2a276f8b89'}
INFO: {'status': 'Waiting', 'progressDetail': {}, 'id': '058670b42da8'}
INFO: {'status': 'Waiting', 'progressDetail': {}, 'id': '9f54eef41275'}
INFO: {'status': 'Retrying in 5 seconds', 'progressDetail': {}, 'id': '8607c8c34ac2'}
INFO: {'status': 'Retrying in 5 seconds', 'progressDetail': {}, 'id': '6816afbbb3be'}
After several attempts, the error is:
INFO: {'errorDetail': {'message': 'EOF'}, 'error': 'EOF'}
✖ Docker push error: EOFI have tried it without the slash, i.e. "my-image-name", it worked properly. Also, I've tried it manually, i.e. doing it with the AWS CLI, and it worked with the slash in the name.
Am I doing something wrong?
Thanks!
Update:
I have tried the name with an underscore an it's failing too.
Also, I've forked the project: https://bitbucket.org/atlassian/aws-ecr-push-image/src/master/ and I've tried the pipe locally, building the Dockerfile and running a container like:
docker run -it -e AWS_ACCESS_KEY_ID=xxx -e AWS_DEFAULT_REGION=xxx -e AWS_SECRET_ACCESS_KEY=xxxx -e IMAGE_NAME=my-group/my-image-name -w $(pwd) -v $(pwd):$(pwd) -v /var/run/docker.sock:/var/run/docker.sock aws-ecr-pipe
And this has worked.
So my suspicion is that maybe it's related to how Bitbucket is managing the variable "IMAGE_NAME".