Skip to content

Conversation

@Bishibop
Copy link
Contributor

@Bishibop Bishibop commented Oct 24, 2025

Summary

Adds validation to ensure every Helm chart configured in .replicated has a corresponding HelmChart manifest (custom resource with kind: HelmChart).

How Validation Works

Two-Phase Design: Lenient Discovery + Strict Validation

The validation uses a separation of concerns approach:

  1. Discovery Phase (Lenient): DiscoverHelmChartManifests() scans manifest paths and returns whatever it finds. If no manifests are configured or no HelmCharts exist, it returns an empty map without
    errors. This allows mixed directories and makes the discovery layer flexible.
  2. Validation Phase (Strict): ValidateChartToHelmChartMapping() enforces the requirement that every chart has a corresponding HelmChart manifest. This is where errors are reported.

Changes

  • Add ValidateChartToHelmChartMapping() function with batch error reporting
  • Validate chart-to-manifest mapping before running linters
  • Return clear errors when charts are missing HelmChart manifests
  • Warn (non-fatal) when orphaned HelmChart manifests are found
  • Update documentation with HelmChart requirements section

Validation Behavior

  • ✅ Success: All charts have matching HelmChart manifests
  • ❌ Error: One or more charts missing manifests (batch reports all)
  • ⚠️ Warning: Orphaned HelmChart manifest (doesn't fail lint)

Validates that every configured Helm chart has a corresponding HelmChart
manifest (kind: HelmChart). This ensures templates can be properly rendered
with builder values during preflight checks.

Key changes:
- New validation layer with batch error reporting for missing manifests
- Refactored extraction to consolidate HelmChart discovery (eliminates duplicate calls)
- Separated discovery (lenient) from validation (strict) layers
- Added auto-discovery support for HelmChart manifests
- Made manifest paths optional in config (validation happens at runtime)

The validation runs after resource discovery but before linting, catching
configuration errors early with clear, actionable error messages.
Adds unit tests, integration tests, CLI tests, and documentation for the
chart-to-HelmChart manifest validation feature to ensure correctness and
provide clear guidance for users.

Changes:
- Add 11 unit tests in validation_test.go covering all validation scenarios
- Add 6 integration tests in validation_integration_test.go with test fixtures
- Add 3 CLI integration tests in lint_test.go for end-to-end validation
- Create 6 test scenario fixtures in testdata/validation/
- Add HelmChart Manifest Requirements section to docs/lint-format.md
- Update existing tests to reflect lenient discovery pattern

The tests cover success cases, error cases (single and batch), warnings for
orphaned manifests, auto-discovery mode, and edge cases. Documentation
includes configuration examples, validation behavior, error messages, and
troubleshooting guidance.
Copy link
Contributor

@bennyyang11 bennyyang11 left a comment

Choose a reason for hiding this comment

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

looks good to me

@Bishibop Bishibop merged commit 03a1f84 into main Oct 24, 2025
5 checks passed
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.

4 participants