argocd-image-updater icon indicating copy to clipboard operation
argocd-image-updater copied to clipboard

feat: update several path for image.tag

Open Tchoupinax opened this issue 1 year ago • 4 comments

Hello folks!

I made this improvement to handle a case we have at work. Let's explain it.

In the current case, we provide a path for the image tag with the annotation .helm.image-tag. It says where to update the tag for this argoCD application.

Now, I have one ArgoCD application with two deployements, different with a suffix. Let's call them a and b. So my helm-chart values are prefixed by the alias of each app.

a:
  image:
    tag: v1.0.0

b:
  image:
    tag: v1.0.0

I want to update both at the same time, the lifecycle is identical. This merge request allows to do it, by adding several paths as value separated by a comma. Then, I can provide

xxxx.helm.image-tag=a.image.tag,b.image.tag

A unit test has been added about tag and name and moreover, I handled every space to ensure it won't have any bug for a mistype.

Finally, I build the customized image and tested, all is OK for me. I hope all is clear!

Thank you for your work, I love this project. Cheers!

Tchoupinax avatar Jul 22 '24 18:07 Tchoupinax

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 82.70%. Comparing base (b179e94) to head (8e9e3cd).

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #793       +/-   ##
===========================================
+ Coverage   70.85%   82.70%   +11.84%     
===========================================
  Files          45       22       -23     
  Lines        5178     1954     -3224     
===========================================
- Hits         3669     1616     -2053     
+ Misses       1344      282     -1062     
+ Partials      165       56      -109     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Jul 22 '24 18:07 codecov-commenter

@Tchoupinax thanks for proposing it. I'll look into it.

chengfang avatar Jul 24 '24 02:07 chengfang

Hello @chengfang, Could you have time to give a look again? 🙏

Tchoupinax avatar Oct 19 '24 15:10 Tchoupinax

Some other places assume that image.name and image.spec represent single-path value, and we should think about if it makes sense for those places to also take multi-path values. For instance,

https://github.com/argoproj-labs/argocd-image-updater/blob/4f21adef41a9dfad16ac6c1d7d7f53bc67e8a79d/pkg/argocd/update.go#L449

https://github.com/argoproj-labs/argocd-image-updater/blob/4f21adef41a9dfad16ac6c1d7d7f53bc67e8a79d/pkg/argocd/update.go#L473

chengfang avatar Oct 21 '24 19:10 chengfang

I will give a look but maybe I need help on your last point (checking if having two paths is OK everywhere)

Tchoupinax avatar Oct 23 '24 21:10 Tchoupinax