Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate image entries with different formats when updating two images #1034

Open
meme8383 opened this issue Feb 7, 2025 · 2 comments · May be fixed by #1037
Open

Duplicate image entries with different formats when updating two images #1034

meme8383 opened this issue Feb 7, 2025 · 2 comments · May be fixed by #1037
Labels
bug Something isn't working

Comments

@meme8383
Copy link

meme8383 commented Feb 7, 2025

Describe the bug
When updating the hash of one image using git method and digest strategy, argocd creates a copy of the other image without the ":latest" tag. This results in the containers not being re-created and remaining on the old images. This can be resolved by manually removing the hashes without the latest tag (after each update). For example, this is what the yaml looks like after attempting to update both images:

# .argocd-source-app.yaml
kustomize:
  images:
  - ghcr.io/org/repo/image-a:latest@sha256:new-hash
  - ghcr.io/org/repo/image-b:latest@sha256:new-hash
  - ghcr.io/org/repo/image-a@sha256:old-hash
  - ghcr.io/org/repo/image-b@sha256:old-hash

To Reproduce
Have an application that uses two different images, and use these parameters:

argocd-image-updater.argoproj.io/update-strategy: digest
argocd-image-updater.argoproj.io/write-back-method: git

Expected behavior
The image is updated with the latest tag, and no other entries are created.

Version
v0.15.2

@meme8383 meme8383 added the bug Something isn't working label Feb 7, 2025
@chengfang
Copy link
Collaborator

I tested with my sample app https://github.com/chengfang/image-updater-examples/tree/main/image-list-kustomize, and was able to reproduce the issue. See the faulty generated file https://github.com/chengfang/image-updater-examples/blob/main/image-list-kustomize/source/.argocd-source-image-list-kustomize.yaml

In more details, if there is no existing write-back target file (.argocd-source-*.yaml) in the target repo, a new file was created correctly, without the issue seen above.

Then I manually deleted sha portion from one of the image, to trigger image-updater to update only one of the images. After reinstalling and app and running image-updater, I was able to see the issue in the modified .argocd-source-*.yaml file.

@meme8383
Copy link
Author

I was also able to resolve the issue in my application by using the newest-build update strategy and removing the :latest tag from my deployments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants