Skip to content

feat(lint): discover helm charts from EC Config manifests#718

Merged
emosbaugh merged 6 commits intomainfrom
emosbaugh/20260506/ec-config-helmchart-validation
May 8, 2026
Merged

feat(lint): discover helm charts from EC Config manifests#718
emosbaugh merged 6 commits intomainfrom
emosbaugh/20260506/ec-config-helmchart-validation

Conversation

@emosbaugh
Copy link
Copy Markdown
Member

Summary

Add support for discovering HelmChart declarations from embeddedcluster.replicated.com/v1beta1 Config manifest extensions.helmCharts.

This allows validation to properly match EC Config helm charts against local chart archives, preventing false-positive warnings for charts declared in EC Config manifests.

Changes

  • DiscoverECConfigHelmCharts() scans manifest globs for EC Config documents and extracts spec.extensions.helmCharts[].chart entries
  • DiscoverHelmChartManifests() now merges both kots HelmChart manifests and EC Config helm chart declarations
  • Duplicate detection works across both source types
  • Unit tests and integration test scenarios added for valid matches and missing archives

emosbaugh added 2 commits May 6, 2026 13:24
Add support for discovering HelmChart declarations from
embeddedcluster.replicated.com/v1beta1 Config manifest extensions.helmCharts.
This allows validation to properly match EC Config helm charts against local
chart archives, preventing false-positive warnings for charts declared in EC
Config manifests.
Comment thread pkg/lint2/helmchart.go
Move struct declarations inside the yaml.v3 decode loop in both
parseHelmChartManifest and parseECConfigHelmCharts. yaml.v3's decoder
modifies the target in place and does not clear fields absent in the
current document, causing phantom entries or false duplicates in
multi-document YAML files.

Also removes unreachable return after the infinite for loop in
parseHelmChartManifest.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2f7950a. Configure here.

Comment thread pkg/lint2/helmchart.go Outdated
Comment thread pkg/lint2/validation_integration_test.go
- parseECConfigHelmCharts: use ecConfigAPIVersion constant from
  embedded_cluster.go instead of hardcoded string to prevent silent
  discovery failures if the API version changes.
- TestLintValidation_ECConfigMissingArchive: use t.Fatalf instead of
  t.Errorf for the warnings length check to prevent index-out-of-bounds
  panic when result.Warnings is empty.
@emosbaugh
Copy link
Copy Markdown
Member Author

[sc-137591]

kriscoleman
kriscoleman previously approved these changes May 7, 2026
Copy link
Copy Markdown
Member

@kriscoleman kriscoleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Comment thread pkg/lint2/helmchart.go Outdated
seenFiles[path] = true

// Quick kind check before parsing
isConfig, err := hasKind(path, "Config")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's multiple Config kinds with different api versions (e.g. KOTS's config, ec's Config, etc...). i guess the below parse continues on error so that might be fine with the current implementation you have but might cause issues later on.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added hasAPIVersionKind function

sgalsaleh
sgalsaleh previously approved these changes May 8, 2026
…scovery

Replace the overly-broad hasKind(path, "Config") quick check in
DiscoverECConfigHelmCharts with hasAPIVersionKind(path, apiVersion, kind),
which verifies both apiVersion and kind. This avoids false-positive matches
against KOTS Config (kots.io/v1beta1) or any other Config kind when scanning
manifest files for EC Config helmCharts declarations.
@emosbaugh emosbaugh dismissed stale reviews from sgalsaleh and kriscoleman via e6ed04f May 8, 2026 16:43
Add comprehensive tests covering:
- EC Config match (correct apiVersion + kind)
- KOTS Config mismatch (same kind, different apiVersion)
- Multi-document YAML with EC Config present
- Multi-document YAML without EC Config
- Empty file returns false
- Valid EC Config parsed by yaml decoder (not regex fallback)
@emosbaugh emosbaugh merged commit eced4e6 into main May 8, 2026
6 checks passed
@emosbaugh emosbaugh deleted the emosbaugh/20260506/ec-config-helmchart-validation branch May 8, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants