Display non-KRM files in kpt pkg tree output#4518
Open
aravindtga wants to merge 2 commits into
Open
Conversation
…age tree Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
✅ Deploy Preview for kptdocs 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
Note
Copilot was unable to run its full agentic suite in this review.
Enhances kpt pkg tree to include non-KRM package files in the rendered tree output (while skipping dotfiles/dot-dirs and avoiding duplicates with KRM-rendered files).
Changes:
- Add filesystem discovery of non-KRM files and pass them into the tree renderer.
- Merge non-KRM “directories” into the tree traversal and render those filenames under each package.
- Add/adjust unit tests to validate listing, sorting, dotfile exclusion, symlink skipping, and deduplication.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| thirdparty/cmdconfig/commands/cmdtree/tree.go | Extends tree rendering to merge and print non-KRM filenames under package branches and dedup against rendered KRM resources. |
| thirdparty/cmdconfig/commands/cmdtree/cmdtree.go | Adds discoverNonKRMFiles that walks the directory tree and supplies non-KRM files to TreeWriter. |
| thirdparty/cmdconfig/commands/cmdtree/cmdtree_test.go | Updates existing expectation and adds new unit tests for non-KRM listing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…overy and rendering Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
4a2028d to
721cf52
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
thirdparty/cmdconfig/commands/cmdtree/tree.go:112
- Parent-branch selection uses
strings.HasPrefix(pkg, parent)which can incorrectly treat sibling directories as ancestors (e.g., parent="a" matches pkg="ab"), causing the tree to nest packages/dirs under the wrong branch. Consider requiring a path-segment boundary (pkg==parent or strings.HasPrefix(pkg, parent+string(filepath.Separator))) or computing the parent viafilepath.Dir(pkg)and walking upward.
for _, pkg := range allKeys {
// create a branch for this package -- search for the parent package and create
// the branch under it -- requires that the keys are sorted
branch := tree
for parent, subTree := range treeIndex {
if strings.HasPrefix(pkg, parent) {
// found a package whose path is a prefix to our own, use this
// package if a closer one isn't found
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.
Summary
Enhances
kpt pkg treeto show all package files, not just KRM resources.Changes
Example
Before:
After:
Testing
AI usage disclosure