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

Feature request: Avoid full file reformatting during updates #797

Open
willbush opened this issue Jul 30, 2024 · 0 comments
Open

Feature request: Avoid full file reformatting during updates #797

willbush opened this issue Jul 30, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@willbush
Copy link

Is your feature request related to a problem? Please describe.

When using:

metadata:
  annotations:
    argocd-image-updater.argoproj.io/image-list: xyz=<image-tag>
    argocd-image-updater.argoproj.io/xyz.update-strategy: digest
    argocd-image-updater.argoproj.io/write-back-method: git
    argocd-image-updater.argoproj.io/write-back-target: kustomization:<path>

An update triggers argocd-image-updater to update a kustomize file with a new digest, it also reformats the entire file. The format style it uses is different from that of yamlfmt and prettier, which causes unnecessary changes in git.

I'm guessing the reformat is done to avoid having to infer how many spaces are needed for indentation.

Describe the solution you'd like

Infer how many spaces are needed for indentation so reformatting the whole file is not needed.

Or only reformat when digest does not exists, and then when it already exists, update it in place without reformating:

# ...
images:
  - name: <image-name>
    digest: sha256:<hash>

Describe alternatives you've considered

We are using treefmt to run a bunch of formatters on code and check style in CI. I might have to manually have it ignore certain kustomize files that have digests that are updated by argocd-image-updater to avoid CI warnings, and let the style be inconsistent.

@willbush willbush added the enhancement New feature or request label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant