argoproj-labs / argocd-image-updater

Automatic container image update for Argo CD
https://argocd-image-updater.readthedocs.io/en/stable/
Apache License 2.0
1.28k stars 261 forks source link

Digest updating to tag instead of sha #490

Open mathewmeconry opened 2 years ago

mathewmeconry commented 2 years ago

Describe the bug Updating an image with the method digest and a tag defined in the image list, doesn't work as expected. Instead of setting the sha256 hash to image.tag it sets the tag defined in the image list. Setting the digest image.tag doesn't work either and image updater overrides it.

To Reproduce Annotations on the argocd application

argocd-image-updater.argoproj.io/backend.helm.image-spec=image.image
argocd-image-updater.argoproj.io/backend.update-strategy=digest
argocd-image-updater.argoproj.io/image-list=backend=ghcr.io/vocdoni/vocdoni-manager-backend:release-1.2

Expected behavior It will set ghcr.io/vocdoni/vocdoni-manager-backend@sha256:b94b0450dbbe52b25739b4fbfb3eb179d850353e599e1c81832ba2d1ae8a701e for image.image instead of ghcr.io/vocdoni/vocdoni-manager-backend:release-1.2

Additional context Add any other context about the problem here.

Version 0.12.0

Logs

time="2022-11-02T09:40:50Z" level=info msg="Setting new image to ghcr.io/vocdoni/vocdoni-manager-backend:release-1.2" alias=backend application=vocdoni-backend-prod image_name=vocdoni/vocdoni-manager-backend image_tag="sha256:b94b0450dbbe52b25739b4fbfb3eb179d850353e599e1c81832ba2d1ae8a701e" registry=ghcr.io
time="2022-11-02T09:40:50Z" level=info msg="Successfully updated image 'ghcr.io/vocdoni/vocdoni-manager-backend@sha256:b94b0450dbbe52b25739b4fbfb3eb179d850353e599e1c81832ba2d1ae8a701e' to 'ghcr.io/vocdoni/vocdoni-manager-backend:release-1.2', but pending spec update (dry run=false)" alias=backend application=vocdoni-backend-prod image_name=vocdoni/vocdoni-manager-backend image_tag="sha256:b94b0450dbbe52b25739b4fbfb3eb179d850353e599e1c81832ba2d1ae8a701e" registry=ghcr.io
time="2022-11-02T09:40:50Z" level=info msg="Committing 1 parameter update(s) for application vocdoni-backend-prod" application=vocdoni-backend-prod
time="2022-11-02T09:40:50Z" level=info msg="Successfully updated the live application spec" application=vocdoni-backend-prod
zrice57 commented 1 year ago

I was experiencing the same issue but I have it working as expected now. There were two things I believe had an impact on this that I changed. I'm on version 0.12.1.

First, I removed tagsortmode: latest-first from my registry configuration. So tagsortmode has no value now. Based on one of the log messages I saw I believe this was preventing metadata from being pulled. Also, this setting isn't in the latest version of the docs so it may not be supposed to be set any longer. I think this setting was the primary issue for me.

Second, and perhaps not relevant based on your setup, I had to set the argocd-image-updater.argoproj.io/brownie.platforms: linux/arm64,linux/amd64 annotation.

LinuxSuRen commented 1 year ago

I'm confusing about this issue. There are three images here. But only the last one is working well.

metadata:
  name: al-cloud-dev
  namespace: argocd
  annotations:
    argocd-image-updater.argoproj.io/image-list: apiserver=10.121.218.184:30002/xxx/apiserver:master,controller=10.121.218.184:30002/xxx/controller:master,console=10.121.218.184:30002/xxx/console:master
    argocd-image-updater.argoproj.io/update-strategy: digest
    argocd-image-updater.argoproj.io/brownie.platforms: linux/amd64

See the part logs:

Setting new image to 10.121.218.184:30002/xxx/controller@sha256:b11ca83facef1f6c94fe965868e63a6ca384aca8b91a59c587aaad2c51d5d907" alias=controller application=xxx image_name=xxx/controller image_tag=dummy registry="10.121.218.184:30002"                                                                                                                  

Successfully updated image '10.121.218.184:30002/al-cloud/controller@dummy' to '10.121.218.184:30002/xxx/controller@sha256:b11ca83facef1f6c94fe965868e63a6ca384aca8b91a59c587aaad2c51d5d907', but pending spec update (dry run=false)" alias=controller application=xxx image_name=xxx/controller image_tag=dummy registry="10.121.218.184:30002

I'm using the following image:

quay.io/argoprojlabs/argocd-image-updater:v0.12.0