Skip to content
Snippets Groups Projects
Commit eda584f9 authored by google-labs-jules[bot]'s avatar google-labs-jules[bot]
Browse files

Fix: Handle OCI artifact versions with '+' correctly

This change addresses an issue where Helm's automatic replacement of '+'
with '_' in version strings causes problems with OCI artifact registries
that do not support '+' in tags.

The following improvements have been made:

- Modified `internal/helper/helper.go`:
    - Added comprehensive documentation to the `SemVerReplace` function.
    - Clarified that `SemVerReplace` focuses on underscore-to-plus
      conversion and does not perform full semver validation.
    - Simplified the `SemVerReplace` function logic.
    - Added extensive unit tests for `SemVerReplace` covering various
      scenarios, including empty strings, multiple underscores,
      leading/trailing underscores, and mixed-case strings.

- Updated `internal/manifest/charts.go`:
    - Added debug logging before attempting underscore-to-plus conversion
      for chart versions.
    - Enhanced error messages to be more specific when a chart version is
      not found, indicating that lookups were attempted with both the
      original reference and the converted reference.

- Updated `internal/manifest/manifest.go`:
    - Ensured consistent handling of underscore-to-plus conversion for
      manifest targets in both GET and HEAD request methods.
    - Added debug logging before attempting underscore-to-plus conversion
      for manifest targets in both GET and HEAD methods.
    - Enhanced error messages to be more specific when a manifest is not
      found, indicating that lookups were attempted with both the
      original target and the converted target.

These changes ensure that versions containing '+' are correctly processed
by first attempting the lookup with the original reference (which might
contain '_') and then, if that fails, by attempting the lookup again
after converting underscores to plus signs. This provides more robust
handling for OCI artifacts and improves debuggability.
parent 1b552515
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment