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

Allow data-only bundles #754

Merged
merged 1 commit into from
Dec 9, 2022
Merged

Conversation

lcarva
Copy link
Contributor

@lcarva lcarva commented Nov 23, 2022

This commit allows the command conftest push to create a bundle that contains data but no policies.

Signed-off-by: Luiz Carvalho [email protected]

@lcarva
Copy link
Contributor Author

lcarva commented Nov 23, 2022

It looks like the failures are due to some underlying CI issue?

12:12:05 PM: Installing dependencies
12:12:05 PM: /opt/build-bin/run-build-functions.sh: line 351: /opt/buildhome/python3.7/bin/activate: No such file or directory
12:12:05 PM: Error setting python version from runtime.txt
12:12:05 PM: Please see https://github.com/netlify/build-image/blob/focal/included_software.md for current versions
12:12:05 PM: Build was terminated: Build script returned non-zero exit code: 1

@boranx
Copy link
Member

boranx commented Nov 24, 2022

yeah, recently the build image has been updated to focal, and seems like it comes with py 3.8
I've created #755 to fix, once its merged, the PR can be rebased or the same changes could be applied

@jalseth
Copy link
Member

jalseth commented Nov 27, 2022

Thanks @boranx for fixing that. I've approved and merged the change.

@lcarva
Copy link
Contributor Author

lcarva commented Nov 28, 2022

Thanks! Checks are now passing after rebasing.

@lcarva
Copy link
Contributor Author

lcarva commented Nov 28, 2022

I realized I opened this PR without providing much context. A data-only bundle would be useful for my use case because it allows my policies to be customizable by simply using a different data set.

For example, I have a rego rule that verifies an image reference comes from a list of allowed OCI registries. I want the list of allowed registries to be customizable without having to change the rego rule.

There's a workaround that can be used to avoid this change:

$ echo 'package empty' > empty.rego
$ conftest push --data ./data --policy ./empty.rego <image>

Basically, use an empty policy to satisfy the requirement. That feels a bit clunky and may have unintended side-effects.

Copy link
Member

@jalseth jalseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor changes requested.

internal/commands/push.go Outdated Show resolved Hide resolved
internal/commands/push.go Outdated Show resolved Hide resolved
internal/commands/push.go Outdated Show resolved Hide resolved
internal/commands/push.go Outdated Show resolved Hide resolved
This commit allows the command `conftest push` to create a bundle that
contains data but no policies.

Signed-off-by: Luiz Carvalho <[email protected]>
Copy link
Member

@boranx boranx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm too
thanks for the PR @lcarva 👍

@lcarva
Copy link
Contributor Author

lcarva commented Dec 7, 2022

I think I addressed all the review comments. Let me know if there's anything else needed to merge this. 🙏

@boranx boranx merged commit 3d77256 into open-policy-agent:master Dec 9, 2022
@lcarva lcarva deleted the data-only-bundles branch December 9, 2022 19:56
simonbaird added a commit to simonbaird/ec-policies that referenced this pull request Jan 9, 2023
0.37 includes the data only bundles support from
open-policy-agent/conftest#754 which I'd
like to use to push a data bundle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants