Skip to content

feat: integrate embedded-cluster CLI lint into release lint pipeline#696

Open
emosbaugh wants to merge 10 commits intomainfrom
emosbaugh/20260417/ec-lint-integration
Open

feat: integrate embedded-cluster CLI lint into release lint pipeline#696
emosbaugh wants to merge 10 commits intomainfrom
emosbaugh/20260417/ec-lint-integration

Conversation

@emosbaugh
Copy link
Copy Markdown
Member

Summary

  • Adds EC lint as an opt-in linter (disabled by default) that runs the embedded-cluster CLI against manifest directories alongside existing Helm, Preflight, and Support Bundle linters
  • New ECLinterConfig type with disabled-by-default IsEnabled() semantics — enable with repl-lint.linters.embedded-cluster.disabled: false
  • Automatically discovers the EC version from the EmbeddedCluster/Config manifest (spec.version) in the manifests directory — no need to configure it separately
  • Downloads the EC binary from S3 (https://tf-staging-embedded-cluster-bin.s3.us-east-1.amazonaws.com/releases/{version}-{os}.tgz) and caches it alongside other tools
  • Supports binary-path config field and REPLICATED_EMBEDDED_CLUSTER_BINARY_PATH env var to bypass the resolver (useful for local dev/testing)
  • Configurable disable-checks list with defaults (helmchart-archive, ecconfig-helmchart-archive)

Example config

repl-lint:
  linters:
    embedded-cluster:
      disabled: false
      # optional overrides:
      # binary-path: /path/to/cli
      # disable-checks:
      #   - preflight-v1beta2

Test plan

  • Run replicated release lint without EC config — EC section shows as disabled
  • Enable EC linting in .replicated, point at a manifests dir with an EmbeddedCluster/Config manifest — version is auto-discovered, binary is downloaded and linting runs
  • Set REPLICATED_EMBEDDED_CLUSTER_BINARY_PATH to a local binary — resolver is bypassed
  • JSON output includes embedded_cluster_results field
  • EC lint errors cause overall linting failed exit code

🤖 Generated with Claude Code

Adds EC lint as an opt-in linter (disabled by default) that runs the
embedded-cluster CLI against manifest directories and surfaces results
alongside Helm, Preflight, and Support Bundle lint output.

- New ECLinterConfig type with disabled-by-default IsEnabled() semantics
- Discovers EC version automatically from the EmbeddedCluster Config manifest
- Downloads the EC CLI binary from S3 by version, caches it alongside other tools
- Supports binary-path config field and REPLICATED_EMBEDDED_CLUSTER_BINARY_PATH
  env var to bypass the resolver
- Configurable --disable checks with sensible defaults

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread pkg/tools/downloader.go Outdated
Comment thread pkg/tools/config.go
Comment thread pkg/tools/downloader.go Outdated
emosbaugh and others added 4 commits April 17, 2026 12:32
…ries

Replaces manifestBaseDirs with ExpandManifestGlobs which expands the
manifest glob patterns from .replicated config to actual YAML file paths,
applying the same gitignore and hidden-path filtering as other linters.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Kots uses LinterConfig where nil Disabled means enabled, so it requires
an explicit boolPtr(true). Also adds a nil-check in ApplyDefaults to
default Kots to disabled when a repl-lint section exists but omits Kots.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread pkg/lint2/embedded_cluster.go Outdated
Comment thread cli/cmd/lint.go Outdated
emosbaugh and others added 2 commits April 17, 2026 12:45
…lyDefaults

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread pkg/lint2/embedded_cluster.go
Comment thread pkg/tools/downloader.go
Comment thread pkg/tools/downloader.go Outdated
return fmt.Errorf("checksum verification failed: %w", err)
}
case ToolEmbeddedCluster:
// No checksum verification for EC archives
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Downloaded EC binary executed without integrity verification

Low Severity

The EC binary is downloaded from S3 and subsequently executed via exec.CommandContext without any checksum or signature verification. All other downloaded tools (Helm, Preflight, Support Bundle) perform checksum verification before execution. A compromised or tampered artifact on the S3 bucket would be silently accepted and run.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e5e82ff. Configure here.

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.

we dont yet have checksums

- Use json.NewDecoder loop in LintEmbeddedCluster to handle trailing content
  after JSON output (matches parseTroubleshootJSON approach)
- Iterate YAML documents in parseECVersionFromFile to find EC Config in
  non-first documents of multi-document YAML files
- Move DiscoverECVersion after binary path resolution so it is skipped when
  a binary path is explicitly provided (no version needed)
- Skip DownloadWithFallback for EC since version is always explicit; fallback
  to latest is unsupported and produced a misleading error message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread cli/cmd/lint.go
emosbaugh and others added 2 commits April 17, 2026 16:19
…o-discovery mode

The early return for "No lintable resources found" ran before the EC linting
block, silently skipping EC lint even when explicitly enabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

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 15a52dd. Configure here.

}

return messages
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant convertECResultToMessages duplicates generic troubleshoot converter

Low Severity

convertECResultToMessages is a near-exact copy of convertTroubleshootResultToMessages in troubleshoot_common.go. The only structural difference is that ecFileResult uses the JSON tag "info" instead of "infos". The conversion logic (iterating errors, warnings, infos and calling formatTroubleshootMessage) is identical. This duplication means any future changes to the message conversion pattern need to be applied in two places.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 15a52dd. Configure 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.

1 participant