amazon-ecr-login icon indicating copy to clipboard operation
amazon-ecr-login copied to clipboard

no basic auth credentials error for random builds

Open davi020 opened this issue 2 years ago • 5 comments

Some time when pipeline fails with the below error: no basic auth credentials, it does not happens regularly but in every 10-15 days this issue is occurring.

Pipeline steps:

  - name: Configure AWS Credentials
    uses: aws-actions/configure-aws-credentials@v1
    with:
     aws-region: ${{env.REGION}}
     role-to-assume: ${{env.ASSUME_ROLE}}
     role-duration-seconds: 1200
     role-skip-session-tagging: true
          

  - name: Login to Amazon ECR 
    id: login-ecr
    uses: aws-actions/amazon-ecr-login@v1
    
  - name: Build, tag, and push image to Amazon ECR
    env:          
      ECR_URL: ${{ steps.login-ecr.outputs.registry }}
    run: |
      docker build -t $ECR_URL/$ECR_REPO:$IMAGE_TAG .
      docker push $ECR_URL/$ECR_REPO:$IMAGE_TAG

My setup -

  • Have 3 runner instances in my self-hosted github runner
  • Using assume role to authenticate with AWS
  • If a build fails, the next build will pass. Issue occurring on random builds

Logs Successfully built 96a7fcd1b011 Successfully tagged ***.dkr.ecr.eu-central-1.amazonaws.com/registry:latest The push refers to repository [***.dkr.ecr.eu-central-1.amazonaws.com/registry] 374b29f6eb29: Preparing 02541b6f86e9: Preparing d36dc390a6a2: Preparing 28adcc2eea7f: Preparing 8c667e7e65fe: Preparing no basic auth credentials Error: Process completed with exit code 1.

davi020 avatar Mar 30 '23 07:03 davi020

@davi020 I am having same issue. What was your work around for this.

nerdeveloper avatar May 25 '23 00:05 nerdeveloper

@davi020 I am also having same issue. did you solve this problem? I am using v2 btw

LiJell avatar Jan 15 '24 08:01 LiJell

@nerdeveloper @LiJell - Hi Guys, This mentioned issue is intermediate and I have fixed it by using the native AWS cli commands -

  • name: Native docker ECR login id: docker-ecr-login run: | result=$(aws ecr get-login-password --region | docker login --username AWS --password-stdin ${{ env.ECR_REGISTRY }}) echo "Login Result: $result"

Let me know if this works!!

davi020 avatar Jan 15 '24 14:01 davi020

@nerdeveloper @LiJell - Hi Guys, This mentioned issue is intermediate and I have fixed it by using the native AWS cli commands -

  • name: Native docker ECR login id: docker-ecr-login run: | result=$(aws ecr get-login-password --region | docker login --username AWS --password-stdin ${{ env.ECR_REGISTRY }}) echo "Login Result: $result"

Let me know if this works!!

Actually I also solved this problem by using aws cli. Thank you for your help :)

LiJell avatar Jan 15 '24 14:01 LiJell

https://medium.com/@johnsonkdavid19/resolving-no-basic-auth-credentials-error-process-completed-with-exit-code-1-in-aws-ecr-github-3d079d79cde3

davi020 avatar Mar 29 '24 02:03 davi020