docker-build-with-cache-action icon indicating copy to clipboard operation
docker-build-with-cache-action copied to clipboard

Issue running with AWS public ecr

Open aradhakrishnanGFDL opened this issue 3 years ago • 2 comments

I followed this issue and it's great that there is support for this action with an AWS public ECR image.

However, I am unable to run my actions successfully. In the hello-world example provided, is it correct that the registry alias does not have to be specified in image-name or registry? (e.g hello-world seems to reside in several different account registry aliases, for instance (see link) . How does the alias get determined automatically or is there a variable I may be missing?

When I provide the following (i.e no registry alias in image_name): uses: whoan/docker-build-with-cache-action@v5 with: registry: public.ecr.aws image_name: image-name/image-name-test image_tag: latest

The following step fails when we do not specify the registry alias.... (Also, repositoryUri points to a private registry in the error log. )

[Action Step] Pulling image... public.ecr.aws/image-name/image-name-test

Subsequently the pipeline fails when it tries to push the above location (as the public ecr registry has a registry alias in its uri)

(Please note the image-name above is just a dummy example)

Now, if I do provide the alias as a prefix in the image_name, the pipeline succeeds, but there is no caching taking place, possibly because of an (not fatal for the pipeline) error that I continue to see.

image_name: registry_alias/image-name/image-name-test

(the error that may not cause the caching checks to take place, if it helps.. but I do not know if its fully related)

2021-11-19T19:26:41.6731854Z An error occurred (RepositoryNotFoundException) when calling the DescribeImageTags operation: The repository with name 'cregistry_alias/image-name/image-name-test-stages' does not exist in the registry with id '***'

Please note that I do have the public registry image for stages also created.

  1. Based on the errors I see and the auto-creation of images in my private registry after the actions pipeline runs, might it be possible that this step [Action Step] Pulling image... tries to pull the private ecr images, creates one if there is none. So, the checksumming always fails to make caching decisions?

Your help is much appreciated. I can share my configurations further if that helps. A cache enabled example with a public ecr would also be very helpful to double check my settings. Thanks,

aradhakrishnanGFDL avatar Nov 22 '21 02:11 aradhakrishnanGFDL

Testing further, this might be where there is an exception thrown that causes the following: (since the registry_alias is supplied as part of the image_name in the yml)

An error occurred (RepositoryNotFoundException) when calling the DescribeImageTags operation: The repository with name 'cregistry_alias/image-name/image-name-test-stages' does not exist in the registry with id '***'

(please note the values are just placeholders)

I have a fix here that helped resolve my issue with a successful caching example with aws public-ecr.

aradhakrishnanGFDL avatar Nov 22 '21 16:11 aradhakrishnanGFDL

Hey @aradhakrishnanGFDL . Thanks for reporting the issue. I haven't used the action in AWS for a while now, but looking at the example I wrote in the readme you just need to provide the image name (image-name-test instead of image-name/image-name-test). Have you tried that?

BTW, I think the trick is that you don't need to specify the alias because it depends of the user who is making the request. You do the request, so your image is read/written.

I will try to get to it at the weekend...

whoan avatar Nov 22 '21 23:11 whoan

Closing as I didn't hear back

whoan avatar Oct 17 '22 22:10 whoan