Plugins/ecr: Error parsing reference "...amazonaws.com/cloud:8.836261e+06" is not a valid repository/tag

Hi

I get the following error:

+ /usr/local/bin/docker tag 088362613129cac713a52a87509bc2cb2185415e 123456789012.dkr.ecr.ap-southeast-2.amazonaws.com/cloud:8.836261e+06
Error parsing reference: "123456789012.dkr.ecr.ap-southeast-2.amazonaws.com/cloud:8.836261e+06" is not a valid repository/tag: invalid reference format
time="2020-11-29T22:35:55Z" level=fatal msg="exit status 1"

Here’s the YAML for the relevant step:

- name: update-image
    image: plugins/ecr
    settings:
      access_key:
        from_secret: aws_ecr_access_key_id
      context: builder
      dockerfile: builder/Dockerfile
      region: ap-southeast-2
      registry: 123456789012.dkr.ecr.ap-southeast-2.amazonaws.com
      repo: cloud
      secret_key:
        from_secret: aws_ecr_secret_access_key
      tags:
      - ${DRONE_COMMIT_SHA:0:8}
      - ${DRONE_BRANCH//\//-}${DRONE_TAG//\//-}
    when:
      event:
      - push

The interesting bit is that the first 12 characters of the commit SHA are only digits: 088362613129. Is this a bug in the ECR plugin?

Please see the following thread which explains this error, and how you can adjust your yaml configuration accordingly.

1 Like