0

I'm working on CI tool to build new docker images and then push them to our registry in AWS ECR. However, I just noticed that I have built an image several times an image that didn't change. This means that I have created and push several tags for the same image id. I would like to avoid spamming our registry with redundant tags. my question is:

is there a way to check the registry for an image id before pushing the image that I just built?

juanp_1982
  • 917
  • 2
  • 16
  • 37

1 Answers1

0

There are multiple ways to handle this

case 1(which i don't feel is right)

  • check for the tags in ECR as a precheck and then build image

case 2(which we use currently)

  • make use of git hook to trigger the pipeline(or build) only when there is a change into the repository

Also on a sidenote, tags with commit hash or datetimestamp would be helpful if its only the binary that keeps changing over the course to keep track of the dependencies which this dockerfile is depended over.

user2039152
  • 146
  • 8
  • hey @user2039152, could you expand on your second case? I think this would be a better solution. how do I configure those hook to trigger when a specific Docker file (or directory) change? – juanp_1982 Aug 07 '20 at 17:18
  • um, we use gitlab here and we can configure hooks for jenkins plugin in repository. Here's the link: https://docs.gitlab.com/ee/integration/jenkins.html – user2039152 Aug 08 '20 at 18:21