Skip to content

Add ability to pass extra arguments to kustomize build command#147

Merged
yxxhero merged 3 commits into
masterfrom
copilot/fix-113
Jun 21, 2026
Merged

Add ability to pass extra arguments to kustomize build command#147
yxxhero merged 3 commits into
masterfrom
copilot/fix-113

Conversation

Copilot AI commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

This PR adds support for passing extra arguments to the kustomize build command, which is needed for kustomize plugins like ksops that require additional flags such as --enable-exec.

Changes Made

Core Implementation

  • Added ExtraArgs []string field to KustomizeBuildOpts struct - allows passing extra arguments to kustomize build operations
  • Added KustomizeBuildArgs []string field to ChartifyOpts struct - exposes the functionality at the main API level
  • Added ExtraArgs []string field to PatchOpts struct - ensures consistent support across all kustomize operations
  • Modified kustomize build command construction - extra arguments are appended to the command after standard flags

CLI Support

  • Added --kustomize-build-arg flag - can be specified multiple times to pass extra arguments
  • Updated help documentation - includes usage examples for the new flag

Testing

  • Added comprehensive unit tests - verify field initialization and argument handling
  • Verified end-to-end functionality - tested CLI with real kustomize operations

Usage Examples

Single extra argument

chartify --kustomize-build-arg="--enable-exec" release-name /path/to/kustomization

Multiple extra arguments

chartify --kustomize-build-arg="--enable-exec" --kustomize-build-arg="--verbose" release-name /path/to/kustomization

Programmatic usage

opts := &chartify.ChartifyOpts{
    KustomizeBuildArgs: []string{"--enable-exec", "--some-other-flag"},
}

Implementation Details

The extra arguments are appended to the kustomize build command after all standard flags:

kustomize build --load-restrictor=LoadRestrictionsNone --enable-helm --helm-command=helm --enable-exec /path/to/build

This approach ensures compatibility with existing functionality while providing the flexibility needed for kustomize plugins.

Fixes #113.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Ability to pass extra arguments to kustomize build. Add ability to pass extra arguments to kustomize build command Sep 9, 2025
Copilot AI requested a review from yxxhero September 9, 2025 23:13
Copilot AI and others added 3 commits June 21, 2026 14:08
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Adds support for passing extra arguments (e.g. --enable-exec for ksops) to
the kustomize build command, exposed via ChartifyOpts.KustomizeBuildArgs and
the CLI flag --kustomize-build-arg (repeatable). The args are threaded through
both KustomizeBuild and Patch, appended before the positional build target.

- Add KustomizeBuildArgs to ChartifyOpts, ExtraArgs to KustomizeBuildOpts
  and PatchOpts, and wire them through Chartify()
- Add --kustomize-build-arg CLI flag
- Rebase onto master: merge with SortOptions field and the kubectl-kustomize
  (bin/usingKubectl) plumbing
- Remove accidentally committed 15MB chartify binary from the repo
- Add spy-based tests verifying ExtraArgs reach the kustomize build command
  (replacing struct-literal-only assertions)
- Update GenerateID hash expectations in tempdir_test.go (the new struct
  field changes the FNV hash over ChartifyOpts)

Fixes #113.

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
@yxxhero yxxhero marked this pull request as ready for review June 21, 2026 06:33
@yxxhero yxxhero merged commit 3a936f5 into master Jun 21, 2026
4 checks passed
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.

Ability to pass extra arguments to kustomize build.

2 participants