-
Notifications
You must be signed in to change notification settings - Fork 309
Description
Describe the bug
We are using image updater to update the images for ephemeral Kubernetes environments. When the environment is created, we use the Production ECR and the latest images, then image updater is configured to look for new images with a regex tag filter in a Staging ECR, and update to it when a new image is available (i.e. after release jobs have run in the ephemeral environment's Pull Request).
We have an Application containing a deployment with one container and an initContainer. The annotations on the Argo App looks like the following:
argocd-image-updater.argoproj.io/crm-backend.allow-tags=regexp:^eph-1438-.+$
argocd-image-updater.argoproj.io/crm-backend.force-update=true
argocd-image-updater.argoproj.io/crm-backend.helm.image-name=container.imageRepository
argocd-image-updater.argoproj.io/crm-backend.helm.image-tag=container.imageTag
argocd-image-updater.argoproj.io/crm-backend.update-strategy=latest
argocd-image-updater.argoproj.io/crm-db-migrations.allow-tags=regexp:^eph-1438-.+$
argocd-image-updater.argoproj.io/crm-db-migrations.force-update=true
argocd-image-updater.argoproj.io/crm-db-migrations.helm.image-name=initContainers.db-migrations.imageRepository
argocd-image-updater.argoproj.io/crm-db-migrations.helm.image-tag=initContainers.db-migrations.imageTag
argocd-image-updater.argoproj.io/crm-db-migrations.update-strategy=latest
argocd-image-updater.argoproj.io/image-list=crm-backend=<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com/crm-backend,crm-db-migrations=<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com/crm-db-migrations
argocd-image-updater.argoproj.io/write-back-method=argocd
When the new version of <staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com/crm-backend
was published, it correctly detected this and updated it, but it also updated <staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com/crm-db-migrations
to an empty image tag:

Which causes a new ReplicaSet to be span up with an incorrect image for the initContainer:
Init:Failed to apply default image tag "<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com/crm-db-migrations:": couldn't parse image name "<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com/crm-db-migrations:": invalid reference format
Looking around this area in the code, it doesn't look like this is supposed to be possible for an image to be updated with no tag. We also did not get any Successfully updated image ...
logs to indicate that image-updater thinks it updated the image here.
I think this is related to having force-update: true
set, but AFAICT this is required to make it watch for images in a repository other than the one it started from?
Worth noting: the Staging ECR for crm-db-migrations
does not have any images that matches this prefix, nor does it have any images with no tag. It should return zero images.
I'm going to enable trace logs and see if I can spot anything else going on, but I wanted to raise this in the mean time incase it is user error and a quick answer.
Expected behavior
The image referenced by the initContainer should not have been updated as no image exists that matches the regex.
Version
argocd:
chart: argocd-image-updater
repoURL: https://argoproj.github.io/argo-helm
targetRevision: 0.12.3 # AppVersion v0.16.0
Logs
time="2025-08-19T17:49:47Z" level=debug msg="Considering this image for update" alias=crm-db-migrations application=crm-backend-1438 image_name=crm-db-migrations image_tag= registry=<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com
time="2025-08-19T17:49:47Z" level=debug msg="Using no version constraint when looking for a new tag" alias=crm-db-migrations application=crm-backend-1438 image_name=crm-db-migrations image_tag= registry=<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com
time="2025-08-19T17:49:47Z" level=warning msg="\"latest\" strategy has been renamed to \"newest-build\". Please switch to the new convention as support for the old naming convention will be removed in future versions." image_alias=crm-db-migrations image_name=<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com/crm-db-migrations registry_url=<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com
time="2025-08-19T17:49:47Z" level=debug msg="target parameters: image-spec= image-name=initContainers.db-migrations.imageRepository, image-tag=initContainers.db-migrations.imageTag" application=crm-backend-1438 image=<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com/crm-db-migrations namespace=argocd
time="2025-08-19T17:49:47Z" level=debug msg="Image '<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com/crm-db-migrations' already on latest allowed version" alias=crm-db-migrations application=crm-backend-1438 image_name=crm-db-migrations image_tag= registry=<staging-ecr-id>.dkr.ecr.eu-west-2.amazonaws.com