registry-image-resource icon indicating copy to clipboard operation
registry-image-resource copied to clipboard

Using `additional_tags` but no `tag` on the source configuration does not push the image with the `latest` tag in ECR

Open idavidmcdonald opened this issue 2 years ago • 1 comments

Describe the bug

I have been pushing images to ECR and setting a tag in additional_tags in the put step.

My source configuration doesn't set the tag value. According to the README, the default is latest.

This results in an image being pushed to only the tag in my additional_tags file.

Given that the default value for tag is latest, I added to my source configuration tag: latest and expected to see no behaviour change. However, instead I now see the behaviour of pushing images to both the tag in my additional_tags file AND also the latest tag.

There is a chance I've gotten confused or misread something or gotten something wrong, apologies if that is the case. However I think it means that either

  • the readme was misleading as there is no default value for tag and that is why latest was not being pushed, or
  • there is an issue when pushing images to ECR (I haven't tested other registries) that it is not pushing images to the default source configuration tag as well

I think it may be the later case, due to a previous comment in a related issue which was about a desire not to push to the tag set in the source configuration which was deemed to not be the direction wanted.

Reproduction steps

- name: source-without-tag-value-set
  type: registry-image
  icon: aws
  source:
    repository: my-repo
    aws_region: eu-west-1
    aws_access_key_id: access-key-id
    aws_secret_access_key: secret-access-key
    aws_session_token: session-token
    - put: api-ecr
      params:
        image: image/image.tar
        additional_tags: api-main/image-tag.txt

where api-main/image-tag.txt is a file with text some-random-tag

The output in Concourse says pushing tag(s) some-random-tag

Expected behavior

Although I'm not 100% as the readme isn't explicit, I think I expected to see the output in Concourse saying pushing tag(s) latest, some-random-tag

Additional context

I actually like to ability to not push to latest everytime I push an image to ECR (we have an immutable ECR repository and pushing to latest everytime will cause it to error when pushing images)...

However, I don't mind what the intended behaviour is (you will know best) but I just wanted to make sure that the expected behaviour is happening and the readme clearly communicates that.

Thank you for your time :)

idavidmcdonald avatar Aug 22 '23 16:08 idavidmcdonald

Hi, the doc says:

additional_tags tag
set push push
no set no push push latest

I think the docs are accurate.

xtremerui avatar Oct 20 '23 15:10 xtremerui