-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add ability for opa inspect to inspect a single file outside of any bundle #6873
Add ability for opa inspect to inspect a single file outside of any bundle #6873
Conversation
f333058
to
d653074
Compare
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.
Change looks good to me. I'm not sure I fully understood the changes to deps though.
Thanks for working on this, Tyler!
internal/bundle/inspect/inspect.go
Outdated
} | ||
|
||
if includeAnnotations { | ||
as, errs := ast.BuildAnnotationSet(maps.Values(moduleMap)) |
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.
Did we add an extra dependency to OPA just for maps.Values
? I think we could just add a util function for that if we don't have one already.
@ashutosh-narkar will do - have been busy but will circle back to this over the weekend, I also need to fix some of the tests as the output table width in CI is not matching my machine. Are you proposing that we add the |
I was thinking in line with the |
Let’s not change the scope as part of this PR. We can always create new issues later if we want the command to do more. |
Sure but I don't think it would be that big of a change to include data files. Either option is fine with me btw. |
06fcdca
to
a4450b1
Compare
@ashutosh-narkar this should be good now! I'm going to open a follow-on issue (#6879) for the |
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.
Thanks @tjons!
Code LGTM, but I'm afraid I still don't understand the dependency changes in this PR 😅 Some dependencies got bumped because it was needed for something changed here, or just as a side quest of sorts? If the latter, perhaps you could do that in a separate PR, so the changes here are isolated to resolving the issue?
Thanks! And sorry if I'm being obtuse about it 😄
ebda3f8
to
f34c89c
Compare
…undle Signed-off-by: Tyler Schade <tyler.schade@solo.io> add ability for opa inspect to inspect a single file outside of any bundle Signed-off-by: Tyler Schade <tyler.schade@solo.io>
f34c89c
to
eeb09fb
Compare
@anderseknert I had backed those changes out but unfortunately it appears I made a mistake and either wasn't thorough enough or more likely messed up the rebase from main. They're gone now! |
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.
Thanks a lot!
Why the changes in this PR are needed?
Resolves #6799 by adding the ability for the
opa inspect
command to handle single files in addition to the currently supported bundle directory and tarball options. This PR is necessary to improve the UX of inspecting annotations in a single file.What are the changes in this PR?
Adds a new method and decision tree to the
opa inspect
command that will process a single file if the argument passed to the command ends with.rego
. Will follow otheropa inspect
processing semantics and behavior - changes are constrained to loading the single file and processing it as its own entity outside of the scope of a bundle.Notes to assist PR review:
I'm not terribly familiar with OPA's WASM capabilities yet - @anderseknert is there anything in this issue you were thinking would extend to WASM as well that I could add?
I also updated vendored deps as part of this PR - let me know if I should back those changes out.
Further comments: