Publish-Docker-Github-Action: Error trying to publish to ecr

Hello,

I’ve been using your Publish-Docker-Github-Action for a few weeks now. The last couple of days it has been working, but now I am getting an error:

Run elgohr/Publish-Docker-Github-Action@master
  with:
    name: XXX.dkr.ecr.***.amazonaws.com/slackcat
    username: AWS
    password: ***
    registry: https://XXX.dkr.ecr.***.amazonaws.com
    snapshot: true
/usr/bin/docker run --name bb8174c67360eedb43f29b6c973638931abe_a24a6d --label 04bb81 --workdir /github/workspace --rm -e INPUT_NAME -e INPUT_USERNAME -e INPUT_PASSWORD -e INPUT_REGISTRY -e INPUT_SNAPSHOT -e INPUT_DOCKERFILE -e INPUT_WORKDIR -e INPUT_BUILDARGS -e INPUT_CACHE -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/slackcat/slackcat":"/github/workspace" 04bb81:74c67360eedb43f29b6c973638931abe

sed: bad option in substitution expression
sh: XXX.dkr.ecr.***.amazonaws.com/slackcat: unknown operand
WARNING! Your password will be stored unencrypted in /github/home/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
invalid argument "https://XXX.dkr.ecr.***.amazonaws.com/XXX.dkr.ecr.***.amazonaws.com/slackcat" for "-t, --tag" flag: invalid reference format
See 'docker build --help'.
##[error]Docker run failed with exit code 125

This is my code:

name: Push Slackcat to ECR

on:
  push:
    branches:
    - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Build the Docker image
      run: docker build . --file Dockerfile --tag slackcat
    - name: Login to ECR
      id: ecr
      uses: elgohr/ecr-login-action@master
      with:
        access_key: ${{ secrets.AWS_ACCESS_KEY }}
        secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        region: us-east-1
    - name: Publish to ECR
      uses: elgohr/Publish-Docker-Github-Action@master
      with:
        name: XXXXXX.dkr.ecr.us-east-1.amazonaws.com/slackcat
        username: ${{ steps.ecr.outputs.username }}
        password: ${{ steps.ecr.outputs.password }}
        registry: ${{ steps.ecr.outputs.registry }}
        snapshot: true

Not sure if something has changed in the action that require me to make changes to my code?

Also, I opened an issue wrt ecr-login-action as I was getting errors there as well: https://github.com/elgohr/ecr-login-action/issues/4

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Apologies, I got redirected to another project that needed my attention. I will close this for now as we have completed our POC for GitHub Actions. When we revisit this and if we encounter any problems, I’ll open up an issue. Thank you for following up and for helping me out.

@delpic The error message you get is thrown directly by aws-cli which makes it a bit tricky to debug. The cause is usually:

  • You don’t have permissions to the relevant call (ie ecr:GetAuthorizationToken)
  • Your credentials are wrong or missing
  • The supplied access key has MFA requirements, but no MFA token is given

Can you verify that you can call aws ecr get-authorization-token and aws ecr get-login locally with the same credentials, and if so, the version of aws-sdk you’re using? It would also be helpful to see the relevant IAM permissions for the credentials you’re using.