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

feat: preserve formatting and comments when updating Helm values file #1039

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kirgene
Copy link

@kirgene kirgene commented Feb 13, 2025

Description

This PR enhances the Helm values file update functionality by preserving the original formatting and comments. Previously, updating the file would overwrite manual formatting and comments, which could be problematic for users who rely on these customizations for clarity and maintenance. By retaining inline comments and specific formatting, this change improves the user experience and reduces potential confusion after automated updates.

Additionally, this update refines how image-name and image-tag keys are handled:

  • By default, key path in image-name and image-tag creates a nested structure. For example:

    argocd-image-updater.argoproj.io/nginx.helm.image-name: image.name
    argocd-image-updater.argoproj.io/nginx.helm.image-tag: image.tag

    Produces:

    image:
      name: app-name
      tag: v1.0.0
  • If a user wants to update Helm values that contain dots, the key path must be quoted (either with double or single quotes):

    argocd-image-updater.argoproj.io/nginx.helm.image-name: '"image.name"'
    argocd-image-updater.argoproj.io/nginx.helm.image-tag: '"image.tag"'

    This will correctly produce:

    image.name: app-name
    image.tag: v1.0.0

These changes ensure greater flexibility and correctness in handling Helm values updates while maintaining user-defined formatting.

@codecov-commenter
Copy link

codecov-commenter commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 82.41758% with 16 lines in your changes missing coverage. Please review.

Project coverage is 62.49%. Comparing base (add409e) to head (7f81de7).

Files with missing lines Patch % Lines
pkg/argocd/update.go 82.22% 9 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1039      +/-   ##
==========================================
- Coverage   62.59%   62.49%   -0.10%     
==========================================
  Files          15       15              
  Lines        2259     2293      +34     
==========================================
+ Hits         1414     1433      +19     
- Misses        755      764       +9     
- Partials       90       96       +6     

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

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.

2 participants