Description
This is an alternate path to achieving PATH
manipulations as discussed in: #10166
The premise is, let the agent decide where a module can store its files (binaries, data, settings, etc).
Let's say the agent discerns that $HOME
is a good place to put files, it can create the appropriate folders/permissions and run module script(s) with the following env variables:
CODER_MODULE_DATA_PATH=~/.local/share/coder_module/${MODULE_ID}
CODER_MODULE_BIN_PATH=~/.local/share/coder_module/${MODULE_ID}/bin
Or let's say $HOME
isn't writable, we can usually default to the agent
directory often located in /tmp
(granted, this is ephemeral storage, so a warning may be prudent).
CODER_MODULE_DATA_PATH=/tmp/coder.xxcxcv/module/${MODULE_ID}
CODER_MODULE_BIN_PATH=/tmp/coder.xxcxcv/module/${MODULE_ID}/bin
As long as we can create an association between coder module (name/id) and whatever coder_script
it has introduced, we should be able to do this fairly easily in the agent.
We can either use a per-module /bin
or a combine bin dir, e.g.
CODER_MODULE_BIN_PATH=~/.local/share/coder_module/bin
Lastly, the agent would make sure to prepend (or append) the module bin dir(s) to PATH
for use in scripts, SSH sessions, etc.