-
Notifications
You must be signed in to change notification settings - Fork 307
feat: add local subcommand to compare two chart folders #866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@bo0tzz maybe we should add an e2e test? |
The rest is LGTM. @bo0tzz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new local
subcommand to the helm-diff plugin that allows comparing two local chart directories. The feature enables developers to see differences between chart versions during development and CI/CD workflows by rendering both charts with helm template
and showing the resulting manifest differences.
Key changes:
- Implements a new
local
subcommand with comprehensive flag support for chart rendering options - Adds comprehensive test coverage for argument validation and command execution
- Updates documentation to include the new subcommand usage and examples
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
cmd/root.go | Registers the new localCmd() subcommand in the main command structure |
cmd/local.go | Complete implementation of the local subcommand with chart rendering and diffing logic |
cmd/local_test.go | Test suite covering argument validation and basic execution scenarios |
README.md | Documentation update adding the local subcommand help text and usage examples |
func (l *local) run() error { | ||
manifest1, err := l.renderChart(l.chart1) | ||
if err != nil { | ||
return fmt.Errorf("Failed to render chart %s: %w", l.chart1, err) |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error messages should start with lowercase letters to follow Go conventions.
return fmt.Errorf("Failed to render chart %s: %w", l.chart1, err) | |
return fmt.Errorf("failed to render chart %s: %w", l.chart1, err) |
Copilot uses AI. Check for mistakes.
|
||
manifest2, err := l.renderChart(l.chart2) | ||
if err != nil { | ||
return fmt.Errorf("Failed to render chart %s: %w", l.chart2, err) |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error messages should start with lowercase letters to follow Go conventions.
return fmt.Errorf("Failed to render chart %s: %w", l.chart2, err) | |
return fmt.Errorf("failed to render chart %s: %w", l.chart2, err) |
Copilot uses AI. Check for mistakes.
args := []string{"template", l.release, chartPath} | ||
args = append(args, flags...) | ||
|
||
cmd := exec.Command(os.Getenv("HELM_BIN"), args...) |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using os.Getenv("HELM_BIN") without validation could allow execution of arbitrary commands. Consider validating the HELM_BIN path or providing a default fallback.
cmd := exec.Command(os.Getenv("HELM_BIN"), args...) | |
helmBin := os.Getenv("HELM_BIN") | |
if helmBin == "" { | |
helmBin = "helm" | |
} | |
cmd := exec.Command(helmBin, args...) |
Copilot uses AI. Check for mistakes.
@yxxhero I'd be down for e2e tests, but I don't think the project has any yet right? How would you like those to look? |
@bo0tzz it will be better if we add e2e test. this is a new feature. thanks so much. |
This adds a new
local
subcommand that diffs two local chart directories. My intended usecase is mainly for development and CI/CD, to see what effects a change has.This code was written entirely by an LLM; if that is a dealbreaker, feel free to just close this PR outright.
If there is appetite for it, I'd like to next build on top of this with a
git
subcommand that diffs two git references against eachother (by checking them out to a temporary folder and then runninglocal
against them).