opa icon indicating copy to clipboard operation
opa copied to clipboard

Add flag to follow symlinks when running opa build

Open tjons opened this issue 1 year ago • 2 comments

Why the changes in this PR are needed?

Per https://github.com/open-policy-agent/opa/issues/6495, it is important to users using build systems like babel to allow opa build to include symlinked files in the bundle directory. Bazel and other build tools create sandboxes of symlinked files before building. As it stands today, opa build only includes regular files and directories by default.

What are the changes in this PR?

This PR adds a boolean flag, --follow-symlinks to the opa build command to allow users to build directories with symlinked files, and have the contents of those symlinked files included in the built bundle.

Notes to assist PR review:

I've included tests for the build command but would appreciate a critical eye as to any other areas that could use testing. Also, I've kept the symlink changes as constrained to the build features as possible, but there are many layers of method calls to get to the core filesystem loading logic, so any ideas for cleaning up this code is welcome.

Further comments:

tjons avatar Jun 07 '24 00:06 tjons

Deploy Preview for openpolicyagent ready!

Name Link
Latest commit 32341effc40108a945d6d027973df543c2becf96
Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/666258dc4105820008e9ebae
Deploy Preview https://deploy-preview-6800--openpolicyagent.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jun 07 '24 00:06 netlify[bot]

Deploy Preview for openpolicyagent ready!

Name Link
Latest commit b58f28cb842279f57a846293a94dd69b74f3ec30
Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/666258ff5f50be0008760453
Deploy Preview https://deploy-preview-6800--openpolicyagent.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jun 07 '24 00:06 netlify[bot]

@johanfylling thanks for the review! sorry it took me a while to respond to your feedback... I think I have it all covered here! Let me know if anything else is needed before I squash all this :)

tjons avatar Jun 30 '24 18:06 tjons

Deploy Preview for openpolicyagent ready!

Name Link
Latest commit 349645672670db8e87977e8c22982f17dbc3d689
Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/6682fa5b3939210008df46e5
Deploy Preview https://deploy-preview-6800--openpolicyagent.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jun 30 '24 18:06 netlify[bot]