Search code examples
githubgithub-actionsgit-tag

Github Tags not updating


I am creating a CI/CD Pipeline for my project. I am building the Images using GitHub Actions and storing them in the AWS ECR.

The whole pipeline works fine but there is a problem with updating the image tags, and whenever I run the pipeline the subsequent runs fail saying the Image Tag already exists in the registry.

I tried multiple times but had no luck.

I tried to fetch the tags from the remote, but it shows the previous version as below enter image description here

When there is already a new Image tag exists in the registry enter image description here

It seems like, the latest tag is not getting updated.

I am using a bash script to read and update the tag while building the image.

Can someone please explain how I can update the tags automatically?


Solution

  • whenever I run the pipeline the subsequent runs fail saying the Image Tag already exists in the registry.

    Change ECR repo settings to MUTABLE to override image tag.

    Reference: https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-tag-mutability.html

    You can configure a repository to turn on tag immutability to prevent image tags from being overwritten. After the repository is configured for immutable tags, an ImageTagAlreadyExistsException error is returned if you attempt to push an image with a tag that is already in the repository.