Skip to content

ArgoCD Image Updater adds empty lines to values.yaml on every write-back with git method #1283

@yassinumer

Description

@yassinumer

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:

  1. The image tag is correctly updated
  2. An additional empty line is inserted in the file (in our case, within a multi-line YAML value)
  3. 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.name

values.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

  1. Use a YAML parser that preserves formatting exactly (like ruamel.yaml in Python with round-trip mode)
  2. Provide an option to use a separate file for image tags (e.g., .argocd-source.yaml) while still supporting single-file use cases
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions