concourse / registry-image-resource

a resource for images in a Docker registry
Apache License 2.0
89 stars 107 forks source link

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

Open idavidmcdonald opened 1 year ago

idavidmcdonald commented 1 year ago

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

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 :)

xtremerui commented 10 months ago

Hi, the doc says:

additional_tags tag
set push push
no set no push push latest

I think the docs are accurate.