Skip to content

Conversation

@DeZin7
Copy link

@DeZin7 DeZin7 commented Oct 22, 2025

Fixes #1289

This commit fixes a regression introduced between v0.14.0 and v0.17.0 where helm values files would be emptied or corrupted when using git write-back with helmvalues: target.

The issue was caused by setting Style: yaml.LiteralStyle on the root MappingNode when initializing an empty helm values structure. The LiteralStyle is intended for scalar string values with block style (|), not for mapping nodes. This caused the YAML encoder to produce incorrect or empty output when marshaling the structure back to YAML.

This regression affected users with multi-source applications using separate image-name and image-tag annotations with helmvalues write-back, resulting in their values files being deleted on update.

Fixes: Regression between v0.14.0 and v0.17.0
Testing: All existing tests pass with this change

@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.85%. Comparing base (2c92bc8) to head (1c2c9bf).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1291      +/-   ##
==========================================
- Coverage   70.85%   70.85%   -0.01%     
==========================================
  Files          45       45              
  Lines        5178     5177       -1     
==========================================
- Hits         3669     3668       -1     
  Misses       1344     1344              
  Partials      165      165              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

DeZin7 and others added 2 commits October 22, 2025 11:04
This commit fixes a regression introduced between v0.14.0 and v0.17.0
where helm values files would be emptied or corrupted when using git
write-back with helmvalues: target.

The issue was caused by setting `Style: yaml.LiteralStyle` on the root
MappingNode when initializing an empty helm values structure. The
LiteralStyle is intended for scalar string values with block style (|),
not for mapping nodes. This caused the YAML encoder to produce incorrect
or empty output when marshaling the structure back to YAML.

This regression affected users with multi-source applications using
separate image-name and image-tag annotations with helmvalues write-back,
resulting in their values files being deleted on update.

Fixes: Regression between v0.14.0 and v0.17.0
Testing: All existing tests pass with this change
Signed-off-by: DeZin7 <[email protected]>
@DeZin7 DeZin7 force-pushed the fix/helm-values-literal-style-regression branch from f8b5bc0 to cb9ddf5 Compare October 22, 2025 18:04
@chengfang
Copy link
Collaborator

Can you enhance one of the tests in pkg/argocd/update_test.go to reproduce the bug and to verify that the bug can be fixed by this pr? For ex,

t.Run("Whitespace only values file from helm source does not cause error", func(t *testing.T) {

I tried some tests but couldn't reproduce the bug. The style Style: yaml.LiteralStyle, seems to be ignored on mapping node without causing any harm.

@chengfang
Copy link
Collaborator

This change was first introduced in #1212 @will4j can you please check if the removal of the style is safe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image Updater overrides Helm values with empty file in multi-source applications

3 participants