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 additional tools during nodejs processes invocation #21638

Open
kevin-oliveira-zocdoc opened this issue Nov 13, 2024 · 0 comments
Open
Labels
backend: JavaScript JavaScript backend-related issues enhancement

Comments

@kevin-oliveira-zocdoc
Copy link

Is your feature request related to a problem? Please describe.
Its quite common to have npm dependencies that needs additional tools/binaries during its installation, e.g. cp, c++, make, etc, especially when using node-gyp. So when npm install / yarn install runs, these additional tools would need to be included in the sandbox's binary shims.

Currently we have a hardcoded set of tools that are included in the sandbox:

@rule(level=LogLevel.DEBUG)
async def node_process_environment(
binaries: NodeJSBinaries, nodejs: NodeJS.EnvironmentAware
) -> NodeJSProcessEnvironment:
default_required_tools = ["sh", "bash"]
tools_used_by_setup_scripts = ["mkdir", "rm", "touch", "which"]
pnpm_shim_tools = ["sed", "dirname"]
binary_shims = await Get(
BinaryShims,
BinaryShimsRequest.for_binaries(
*default_required_tools,
*tools_used_by_setup_scripts,
*pnpm_shim_tools,
rationale="execute a nodejs process",
search_path=nodejs.executable_search_path,
),
)
, but iiuc there is no way to specify such additional tools.

Describe the solution you'd like
Maybe we could have an option tools on the nodejs subsystem where we could specify which additional tools to include during nodejs processes invocation, similar to the tools option we have on the docker subsystem: https://www.pantsbuild.org/2.22/reference/subsystems/docker#tools.

Describe alternatives you've considered
None.

Additional context
When such additional tools are not included in the sandbox, e.g. cp, the package manager installation, in this case yarn install, fails with:

/bin/sh: cp: command not found
make: *** [../build/bindings/iltorb.node] Error 127
gyp ERR! build error 
@tgolsson tgolsson added the backend: JavaScript JavaScript backend-related issues label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: JavaScript JavaScript backend-related issues enhancement
Projects
None yet
Development

No branches or pull requests

2 participants