Skip to content
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

Improve error message when building from parent directory #152

Open
ronenh opened this issue Oct 18, 2023 · 1 comment
Open

Improve error message when building from parent directory #152

ronenh opened this issue Oct 18, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ronenh
Copy link
Contributor

ronenh commented Oct 18, 2023

Given a policy repo with the structure below, where the policy lives in content/src, running policy build . from the root of the repo results in the following error:

build failed: failed to build opa policy bundle: 3 errors occurred:
src/policies/rebac.check.rego:14: rego_type_error: undefined function ds.check_relation
src/policies/rebac.check_permission.rego:13: rego_type_error: undefined function ds.check_permission
src/policies/rebac.check_relation.rego:13: rego_type_error: undefined function ds.check_relation

The reason for the error is that the .manifest file isn't in the root, it's in content/src but the error message doesn't point users to the cause of the failure.

Repo structure:

.
├── README.md
└── content
    ├── .gitignore
    ├── README.md
    └── src
        ├── .manifest
        └── policies
@ronenh ronenh added the enhancement New feature or request label Oct 18, 2023
@glennblock
Copy link

I just tested this a bit and if the .manifest is copied into content it works.

glennblock@Glenns-M2 src % cd ..
glennblock@Glenns-M2 content % ls
README.md	src
glennblock@Glenns-M2 content % policy build . -t glennblock/policy-rebac:1.0.0

Created new image.
digest: sha256:30e30695c1574faa3fdfa7226971252293e469d45d05c63df243dcdda6e6c282

I wonder if the solution here is to walk the tree to find the .manifest first and then use that as the path to run out of?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants