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 263 forks source link

Cannot pull Image from GCR for images with created timestamp as Jan 1, 1970 #529

Open Akshaya-T opened 1 year ago

Akshaya-T commented 1 year ago

Describe the bug Images getting pushed to the GCR using docker-build-push action in Github. But when image updater tries to update the latest tag in the deployment it errors out.

Expected behavior Image updater should update the latest tag in the pods.

Additional context Images are getting created with the timestamp Jan 1, 1970 in GCR. For those images I could face the issue.

Version

/ $ /usr/local/bin/argocd-image-updater version
argocd-image-updater: v99.9.9+90897c8
  BuildDate: 2022-06-01T09:55:45Z
  GitCommit: 90897c8d17fa3996c09ab4f313c5a8e1cfae8ece
  GoVersion: go1.17.8
  GoCompiler: gc
  Platform: linux/amd64

Logs

time="2023-01-20T07:22:07Z" level=error msg="Error fetching metadata for prod/integrations:master-cijob-799-commit-51c6b08 - neither V1 or V2 or OCI manifest returned by registry: manifest unknown: Manifest with tag 'master-cijob-799-commit-51c6b08' has media type 'application/vnd.oci.image.index.v1+json', but client accepts 'application/vnd.oci.image.manifest.v1+json,application/vnd.docker.distribution.manifest.v1+prettyjws,application/vnd.docker.distribution.manifest.v2+json,application/vnd.docker.distribution.manifest.list.v2+json'." alias=integrations application=integrations image_name=prod/integrations image_tag=master-cijob-790-commit-db5a000 registry=gcr.io
jannfis commented 1 year ago

This is documented here

Akshaya-T commented 1 year ago

@jannfis the image updater was working for the strategies we defined, but suddenly the build pipeline pushed images with older incorrect timestamps (Jan 1, 1970 in GCR), from then image updater started failing and reverting the images.

dennbagas commented 1 year ago

Actually this is not a bug. It is mentioned in the ArgoCD Image Updater documentation here: https://argocd-image-updater.readthedocs.io/en/stable/basics/update-strategies/#latest-update-to-the-most-recently-built-image

Fluxcd can update a reproducible build by sorting part of an image tag using regex: https://fluxcd.io/flux/components/image/imagepolicies/#examples. Maybe we can implement something like this in ArgoCD Image Updater? This would be very useful