I have a hardware vendor tool that is 85GB and tak...
# plugins
a
I have a hardware vendor tool that is 85GB and takes over an hour to install so, it doesn't make sense to put it in a Digest. It is also made up of 100s of files so BinaryPath doesn't work. How can I add it to the sandbox without digesting it?
🤯 4
✅ 1
h
Huh! I still think something like
BinaryPath
maybe, only it might require extra work. The general idea of
BinaryPath
is to use something pre-installed rather than having Pants manage it What is the tool's layout like? How do you invok it?
Note that you can hardcode absolute paths, like
/usr/bin/curl
.
BinaryPath
is only meant to make things more flexible that we do some discovery If it's an internal plugin, you have a lot more flexibility to do "less generalizable" things. Like, simply use
/path/to/tool
and make sure everyone in your org has that path Or, define an option
[my-tool].path
that lets users hardcode which path they should use
a
From inside the sandbox anything with an absolute path is accessible?
h
Yes, that is how things like running Python work, that we first discover the absolute path and then use that
It is not 100% "secure" sandboxing. @ancient-vegetable-10556 actually just gave a talk about this at Pycon yesterday! this slide gets to the gist of it: https://twitter.com/benjy/status/1520843698061590528 We are deciding amongst several tradeoffs with our sandboxing strategy
a
I tried using BinaryPath for the main binary, vivado, but, it failed because it calls another binary inside it. I think it uses a relative path in that case.
h
Hm, while iterating, could you start w/ an absolute path?
a
I believe so. I gave BinaryPath along with BinaryPathTest the absolute path of vivado but, BinaryPathTest when running to get the version doesn't return 0 which is unexpected
h
Ah to clarify, I mean drop
BinaryPath
entirely for now. In your
Process
, simply do
Process(["/path/to/tool", "arg1"])
a
Ah ok, I wasn't sure about trying that but, I will now.
🤞 1
Thanks, that does work. I did have to add my PATH to the Process env for it to work.
h
Cool! How scalable will that be for your needs?
I did have to add my PATH to the Process env for it to work.
That would imply that the underlying tool itself expects
PATH
to be set for things to work. That's pretty common.
a
I think that should be at least for now. I may try to trim back the entries in PATH in the future. Thanks, for helping I understand better how the sandbox works.
h
Sweet. Re trimming the PATH, @curved-television-6568 added a super neat utility to help you do that. Normally
PATH
makes you set
PATH=/usr/bin
to access a binary like
/usr/bin/tar
. This helper will create a shim that only exposes the specific binaries you want https://github.com/pantsbuild/pants/pull/14374
Do feel free to keep asking for help with your plugin or general Pants btw 🙂 we're happy to help
a
Oh thats the BinaryShims. Yeah I was thinking of using that
âž• 1