Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

no basic auth for ECR push causing failure

I have a java service that I am trying to create a pipeline to build, create a docker image, tag and push to my ECR.

 

Steps so far: 

Created IAM account with AmazonEC2ContainerRegistryPowerUser privileges.

Created the following repository variables in Bitbucket: 

  • AWS_REGISTRY_URL
  • AWS_DEFAULT_REGION
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY

I have the following bitbucket-pipelines.yml:

image: openjdk:8

pipelines:
default:
- step:
caches:
- gradle
script:
- bash ./gradlew build -x test
branches:
  develop:
- step:
image: openjdk:8
services:
- docker
script:
- docker version
- echo "This script runs only on commit to the develop branch."
- bash ./gradlew build -x test


# Login to AWS
# - export LOGIN=$(aws ecr get-login --no-include-email --region us-west-1)
# - $LOGIN
- eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email)

# build docker image
- docker build -t my-image .

# tag and push docker images to ECR
- docker tag icverify-gateway:latest xxxxxxxxxxx.amazonaws.com/my-image:qa
- docker push xxxxxxxxxxx.amazonaws.com/my-image:qa

# register the ECS task definition and capture the version
- export IMAGE_NAME=xxxxxxxxxxx.amazonaws.com/my-image:qa
- export TASK_VERSION=$(aws ecs register-task-definition --family my-image -- container-definitions "[]")



I then get the following on code commit:

+ docker push xxxxxxxxxxx.amazonaws.com/my-image:qa
The push refers to repository [xxxxxxxxxxx.amazonaws.com/my-image]
ac079aa23bfa: Preparing
ceaf9e1ebef5: Preparing
9b9b7f3d56a0: Preparing
f1b5933fe4b5: Preparing
no basic auth credentials

 

1 answer

0 votes
davina Atlassian Team Jun 25, 2019

 

Hey @dclark_talentwave 

It's hard to say without seeing all the details, but a common fix is adding `| sed 's|https://||'` to your `eval` command.

You might find more clues in this thread.

Thank you, I added that to my login but I get the same error.  I am strictly using user/pass for authentication here - but is a cert required for this to work?  

Like Sarah Dwyer likes this

Did you find a solution? I'm having the same issue.

Like Sarah Dwyer likes this

Likewise I'm encountering the very same issue, can the documentation be updated to reflect the pipeline requirements?

Like Todd_Schroeder likes this

Same issue here...

@davina  This is what I am getting from the output before the "no basic auth credentials":

Command:

eval $(aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin ${AWS_REGISTRY_URL}) | sed 's|https://||'

Error:

bash: aws: command not foundError: Cannot perform an interactive login from a non TTY device

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,886 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you