Skip to content

Add Helm HTTP repository metadata support #60

Description

@andrew

Version: git-pkgs/registries current main at 418e68a.

Trying to create a Helm HTTP repository client after importing all registries currently returns unknown ecosystem: helm:

_, err := registries.New("helm", "https://charts.example.com", nil)

Add a helm registry that reads the repository's index.yaml. Helm models the file as an IndexFile containing chart names and version entries. Each ChartVersion combines chart metadata with artifact URLs, creation time, removal state, and digest. The chart metadata includes description, home, sources, maintainers, deprecation, and dependencies.

The configured URL should be the HTTP repository root, with index.yaml appended, or an exact index.yaml URL. There is no canonical Helm repository and therefore no default URL. Register an empty default and make core.New return a clear error when both the requested URL and registered default are empty.

Map the index data as follows:

  • FetchPackage should return the chart name, description, home, source repository, keywords, latest non-deprecated version, and remaining chart fields in Package.Metadata.
  • FetchVersions should preserve chart version strings, created as PublishedAt, removed as StatusYanked, deprecated as StatusDeprecated, digest as Integrity, and all resolved artifact URLs in Version.Metadata. Normalize sha256:<hex> to the repository convention sha256-<hex>. Do not treat Helm's deprecated checksum field as the current digest.
  • FetchDependencies should return the dependency name and version constraint. Keep repository, alias, condition, tags, and import values in version metadata because the shared dependency type cannot represent them.
  • FetchMaintainers should map the name, email, and URL supplied by the chart entry.
  • Resolve relative chart URLs against the URL of index.yaml; preserve absolute HTTP URLs. Helm's relative URL fixture and basic-auth URL fixture provide examples. If an entry has several URLs, expose them all in metadata and use the first resolved URL for the current single-value URLBuilder.Download method.

Follow the new ecosystem layout, register the package from all/all.go, and add it to the root ecosystem tests. Use a small YAML parser rather than importing Helm as a dependency.

This also depends on acceptance of package-url/purl-spec#236 and a matching helm type in git-pkgs/purl. Until then the direct registry API can be tested, but NewFromPURL cannot parse Helm PURLs.

Tests should cover several chart versions, deprecated and removed entries, dependencies and maintainers, relative and absolute URLs, multiple artifact URLs, missing optional fields, malformed indexes, a missing configured URL, custom authentication through the supplied HTTP client, and not-found package and version lookups.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions