-
Notifications
You must be signed in to change notification settings - Fork 314
Description
Bug Description
When using the git write-back method with helmvalues:values.yaml, ArgoCD Image Updater successfully updates the image tag but adds an empty line to the YAML file on each update. This causes the file to accumulate blank lines over time, degrading the file quality and creating noisy git history.
Current Behavior
Every time ArgoCD Image Updater writes back to values.yaml:
- The image tag is correctly updated
- An additional empty line is inserted in the file (in our case, within a multi-line YAML value)
- Git commits show
1 insertion(+)even when only the image tag changed
Example git diff from recent update:
diff --git a/apps/charts/my-app/values.yaml b/apps/charts/my-app/values.yaml
index 00f125d..8dab353 100644
--- a/apps/charts/my-app/values.yaml
+++ b/apps/charts/my-app/values.yaml
@@ -121,6 +121,7 @@ componentEnv:
+
{After 70+ updates, the file now has accumulated ~75 consecutive blank lines (see lines 51-126 in the current file).
Expected Behavior
ArgoCD Image Updater should update only the image.tag field without introducing any formatting changes or additional whitespace.
Configuration
ApplicationSet annotations:
argocd-image-updater.argoproj.io/write-back-method: git
argocd-image-updater.argoproj.io/write-back-target: helmvalues:values.yaml
argocd-image-updater.argoproj.io/git-branch: main
argocd-image-updater.argoproj.io/<app>.helm.image-tag: image.tag
argocd-image-updater.argoproj.io/<app>.helm.image-name: image.namevalues.yaml structure:
The file contains standard Helm values including multi-line YAML values (using > folded scalar style).
Environment
- ArgoCD Image Updater: 0.12.3
- Kubernetes cluster managed via ArgoCD
- Multiple applications using ApplicationSet with automatic image updates
Additional Context
This issue makes the git history very noisy with automatic commits that show file modifications beyond the intended image tag update. It also degrades the YAML file quality over time.
Potential Solutions
- Use a YAML parser that preserves formatting exactly (like
ruamel.yamlin Python with round-trip mode) - Provide an option to use a separate file for image tags (e.g.,
.argocd-source.yaml) while still supporting single-file use cases - Add validation to prevent unintended whitespace changes before committing
Related Issues
- Similar formatting issues have been reported in other YAML processing tools
- This appears to be related to the YAML library used for parsing and writing files