question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ECR Password Is Not Populated

See original GitHub issue

Hello,

I am using the amazon-ecr-login to generate an ecr_username and ecr_password to use with a docker login as follows but the password doesn’t seem to be populated


      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: eu-west-1

      - name: Login to Amazon ECR
        id: login_ecr
        uses: aws-actions/amazon-ecr-login@v1

## and then 

    outputs:
      ecr_username: ${{ steps.login_ecr.outputs.docker_username_<aws_acc_no>_dkr_ecr_eu_west_1_amazonaws_com }}
      ecr_password: ${{ steps.login_ecr.outputs.docker_password_<aws_acc_no>_dkr_ecr_eu_west_1_amazonaws_com }}

I then reference them in a separate job like this

    services:
      container:
        image: <aws_acc_no>.dkr.ecr.eu-west-1.amazonaws.com/<repo_name>/<container>:<short_sha>
        credentials:
          username: ${{ needs.build.outputs.ecr_username }}
          password: ${{ needs.build.outputs.ecr_password }}

When printed out the username echos as AWS where as password does not, I suspected this was due to masking but I get this error

Error: .github/workflows/ci.yml (Line: 277, Col: 21): Unexpected value ''
Error: The template is not valid. .github/workflows/ci.yml (Line: 277, Col: 21): Unexpected value ''

As a way round this I ran the following in the workflow and it works

      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: eu-west-1

      - name: get ECR username & password
        id: extract_password
        run: echo "##[set-output name=ecr_password_2;]$(aws ecr get-login-password)"

    outputs:
      ecr_password_2:  ${{ steps.extract_password.outputs.ecr_password_2 }}

    services:
      container:
        image: <aws_acc_no>.dkr.ecr.eu-west-1.amazonaws.com/<repo_name>/<container>:<short_sha>
        credentials:
          username: AWS
          password: ${{ needs.build.outputs.ecr_password_2 }}

I’m not sure what’s happening with password as it doesn’t seem to be populated

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
arjramancommented, Jul 5, 2022

@kurtislamb so the issue is that a key (e.g. ecr_password) under the ‘outputs’ key doesn’t populate if the value given to it is a secret, which the password outputted by the amazon-ecr-login action is while the username is not. I am currently looking for a workaround to see if it’s possible.

0reactions
monirulcommented, Aug 8, 2022

@kurtislamb, Can you pls give it a try. @arjraman recently fixed this issue issue in version 1.5.1 and it should work now. Use the following syntax in the yaml file as it automatically picks the latest version (1.X.X) uses: aws-actions/amazon-ecr-login@v1

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS ECR get-login-password not working
If the AWS ECR get-login-password not working, worry not. Our experts are offering troubleshooting tips to fix the issue. Click to read.
Read more >
Troubleshooting Amazon Elastic Container Registry Identity ...
Use the following information to help you diagnose and fix common issues that you might encounter when working with Amazon ECR and IAM....
Read more >
ECR get-login-password for docker login yields 400 bad request
Tried manually from CLI and it worked but not working from the PLUGIN, could be a plugin issue. UPDATE 2. There is no...
Read more >
Problem in getting result from 'aws ecr get-login' - Stack Overflow
C:>aws ecr get-login-password --no-verify We will get the password.Please find below the password column. C:\docker login --username AWS -- ...
Read more >
get-login-password — AWS CLI 2.9.11 Command Reference
After you have authenticated to an Amazon ECR registry with this command, ... get-login-password [--debug] [--endpoint-url <value>] [--no-verify-ssl] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found