porchctl improvments (v2) - #1168
Open
mozesl-nokia wants to merge 3 commits into
Open
Conversation
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> Assisted-by: Cursor:claude-sonnet-5 Assisted-by: Cursor:grok-4.6
mozesl-nokia
requested review from
efiacor,
kispaljr and
liamfallon
as code owners
September 1, 2026 15:00
✅ Deploy Preview for kpt-porch ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves porchctl CLI ergonomics by making namespace resolution more automatic, adding flag aliases/shorthands, refining rpkg get selectors to be additive, and enabling safer overwrites for rpkg pull, with corresponding unit and e2e test updates (including v1alpha2 parity).
Changes:
- Add namespace auto-resolution (
EnsureNamespace) and apply it across multiplerpkg/repocommands (v1alpha1 and v1alpha2). - Enhance CLI UX: new/updated flag shorthands and aliases, plus additive field selectors for
rpkg get(incl. repository filtering). - Update/add tests and docs for the new behaviors; add
install-porchctlmake target and adjust main command execution wrapper.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/cli/testdata/rpkg-pull-overwrite/config.yaml | New e2e coverage for rpkg pull overwrite/--force behavior. |
| test/e2e/cli/testdata/rpkg-get/config.yaml | Update golden output for --show-kptfile flag incompatibility message. |
| test/e2e/cli/testdata/rpkg-get-selectors/config.yaml | New e2e coverage validating additive rpkg get selectors. |
| test/e2e/cli/testdata/rpkg-default-namespace/config.yaml | New e2e coverage for default namespace resolution (no explicit --namespace). |
| test/e2e/cli/suite.go | Test harness updates for default-namespace runs and repo registration handling. |
| test/e2e/cli/config.go | Add defaultNamespace test-case configuration flag. |
| test/e2e/cli/cluster.go | Logging format tweak for kubectl readiness checks. |
| test/e2e/cli-v1alpha2/testdata/rpkg-get/config.yaml | Update v1alpha2 golden output for --show-kptfile incompatibility message. |
| pkg/cli/commands/rpkg/util/common.go | Add EnsureNamespace, package-metadata helpers, and flag-alias normalization utility; update RunForEachPackage. |
| pkg/cli/commands/rpkg/util/common_test.go | Add tests for namespace resolution, alias normalization, and metadata-based package comparison. |
| pkg/cli/commands/rpkg/reject/v1alpha2.go | Use EnsureNamespace for v1alpha2 reject. |
| pkg/cli/commands/rpkg/reject/command.go | Switch RunForEachPackage to pass ConfigFlags for namespace resolution. |
| pkg/cli/commands/rpkg/push/command.go | Use EnsureNamespace when creating resources. |
| pkg/cli/commands/rpkg/pull/command.go | Add --force/-f and allow overwriting dir when safe/forced. |
| pkg/cli/commands/rpkg/pull/command_test.go | Add unit tests for overwrite behavior (same package vs different + --force). |
| pkg/cli/commands/rpkg/proposedelete/v1alpha2.go | Use EnsureNamespace for v1alpha2 propose-delete. |
| pkg/cli/commands/rpkg/proposedelete/command.go | Switch RunForEachPackage to pass ConfigFlags. |
| pkg/cli/commands/rpkg/propose/v1alpha2.go | Use EnsureNamespace for v1alpha2 propose. |
| pkg/cli/commands/rpkg/propose/command.go | Switch RunForEachPackage to pass ConfigFlags. |
| pkg/cli/commands/rpkg/init/v1alpha2.go | Use EnsureNamespace for v1alpha2 init checks/creation. |
| pkg/cli/commands/rpkg/init/command.go | Add -d/-r/-w and aliases (--repo/--ws/--desc) via normalization; use EnsureNamespace. |
| pkg/cli/commands/rpkg/get/v1alpha2.go | Make selectors additive via shared selector builder; add repository filtering. |
| pkg/cli/commands/rpkg/get/v1alpha2_test.go | Add v1alpha2 repository filter test. |
| pkg/cli/commands/rpkg/get/command.go | Add --repository/-r and aliases; implement additive selector string; add repository filtering. |
| pkg/cli/commands/rpkg/get/command_test.go | Update/extend tests for repository filtering and alias parsing. |
| pkg/cli/commands/rpkg/docs/docs.go | Update docs to reflect new flags/aliases and rpkg pull --force. |
| pkg/cli/commands/rpkg/del/v1alpha2.go | Use EnsureNamespace for v1alpha2 delete. |
| pkg/cli/commands/rpkg/del/command.go | Use EnsureNamespace for v1alpha1 delete. |
| pkg/cli/commands/rpkg/copy/v1alpha2.go | Use EnsureNamespace for v1alpha2 copy. |
| pkg/cli/commands/rpkg/copy/command.go | Add -w/--ws aliasing and use EnsureNamespace. |
| pkg/cli/commands/rpkg/copy/command_test.go | Add alias parsing test for --ws. |
| pkg/cli/commands/rpkg/clone/v1alpha2.go | Use EnsureNamespace for v1alpha2 clone. |
| pkg/cli/commands/rpkg/clone/command.go | Use EnsureNamespace for v1alpha1 clone paths. |
| pkg/cli/commands/rpkg/approve/v1alpha2.go | Use EnsureNamespace for v1alpha2 approve. |
| pkg/cli/commands/rpkg/approve/command.go | Switch RunForEachPackage to pass ConfigFlags. |
| pkg/cli/commands/repo/unreg/command.go | Replace manual namespace handling with EnsureNamespace. |
| pkg/cli/commands/repo/reg/command.go | Add -d and flag aliases; use EnsureNamespace instead of manual kubeconfig namespace logic. |
| pkg/cli/commands/repo/docs/docs.go | Update repo docs for new aliases/flag formatting. |
| make/build.mk | Add install-porchctl make target. |
| cmd/porchctl/main.go | Replace component-base/cli helper with local wrapper to avoid global normalization side-effects. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
|
kushnaidu
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


porchctlimprovmentsSupersedes #554
Description
porchctl rpkg getfield selectors, made the selectors additive--namespaceis no longer necessary for most commands, will try to default to kubeconfig context, env var, or "default"porchctl rpkg pullcan now overwrite a folder's contents if it is the same package or--forceis passed to itRelated Issue(s)
Type of Change
Checklist
Additional Notes (Optional)
AI Disclosure
If so, please describe how: