Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 9, 2025

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 and others added 2 commits September 9, 2025 23:06
- Add ExtraArgs field to KustomizeBuildOpts struct
- Add KustomizeBuildArgs field to ChartifyOpts struct
- Add ExtraArgs field to PatchOpts struct
- Update kustomize build command construction to include extra args
- Add CLI flag --kustomize-build-arg for passing extra arguments
- Add comprehensive tests for new functionality

This allows users to pass extra arguments like --enable-exec to kustomize build,
which is needed for plugins like ksops.

Co-authored-by: yxxhero <[email protected]>
@Copilot 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 Copilot AI requested a review from yxxhero September 9, 2025 23:13
Copilot finished work on behalf of yxxhero September 9, 2025 23:13
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