-
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
opa check
should ignore non-Rego files
#6317
Comments
In bundle mode, we read all files as seen here. We could apply some auto filters maybe to only read the Rego files. |
Thanks Ash. FWIW, I did not run with the |
Currently it reads both data and policy files. You mentioned that you saw errors merging data files. Did that happen w/o the |
Yes, it happened without the bundle flag, and bundle mode did not resolve it. A lot of projects in the infra space keeps test data files like resouce manifests in each policy directory, so you'll see lots of directories containing things like:
They then have some custom script that'll run tests in each directory separately. I have suggested in the past that OPA would better support this natively to avoid having users glue together their tests with bash scripts. But leaving that aside, there's no reason |
Seems that way to me as well. Applying some auto filters seems like one way to resolve this. |
I'll work on this |
Running
opa check --strict
on a couple of policy libraries in the wild, and I'm seeing all sorts of errors related to data files in the scanned directories (commonly, merge errors). It's not clear to me why a command that describes its own role as:Would need to attempt merging data files found in directories it traverses. I'm currently deploying something like:
as a workaround, but I doubt most users would come to the conclusion that's what's needed in order to solve the quite opaque "merge error" (with no further explanation given) failure.
It is imperative that this command is easy to run regardless of project structure, so unless there are good reasons for parsing data files as part of this process, we shouldn't. If there are good reasons for doing that, we should explain those in the output of
opa check --help
. Given that the command seems to do exactly what I asked for with the--ignore
flags provided, I doubt that's the case though.The text was updated successfully, but these errors were encountered: