-
Notifications
You must be signed in to change notification settings - Fork 887
Allow the coder agent to tell modules where they can place data, binaries, etc #11131
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
Comments
We should avoid using |
@bpmct why not using |
Agreed, storing data in persistent storage can help speed up workspace startup times and reduce flakes, e.g. waiting on I'm not a fan of too many options, but we could have both and a module can make its decision. Like |
My concern about Plus, modules already have to download stuff every time into a non-home dir (e.g. code-server into bin). I agree I'd be good to have some form of caching for all of these utils but I worry about the trade-off "configuration/script drift" Don't consider this blocking, just one thing to consider. I would be very happy to have a module bin and would happily write a few extra lines to compare a script in $HOME over a janky way to override PATH |
The agent is extended with a `--script-data-dir` flag, defaulting to the OS temp dir. This dir is used for storing `coder-script/bin` and `coder-script/[script uuid]`. The former is a place for all scripts to place executable binaries that will be available by other scripts, SSH sessions, etc. The latter is a place for the script to store files. Since we default to OS temp dir, files are ephemeral by default. In the future, we may consider adding new env vars or changing the default storage location. Workspace startup speed could potentially benefit from scripts being able to skip steps that require downloading software. We may also extend this with more env variables (e.g. persistent storage in HOME). Fixes #11131
The agent is extended with a `--script-data-dir` flag, defaulting to the OS temp dir. This dir is used for storing `coder-script/bin` and `coder-script/[script uuid]`. The former is a place for all scripts to place executable binaries that will be available by other scripts, SSH sessions, etc. The latter is a place for the script to store files. Since we default to OS temp dir, files are ephemeral by default. In the future, we may consider adding new env vars or changing the default storage location. Workspace startup speed could potentially benefit from scripts being able to skip steps that require downloading software. We may also extend this with more env variables (e.g. persistent storage in HOME). Fixes #11131
The agent is extended with a `--script-data-dir` flag, defaulting to the OS temp dir. This dir is used for storing `coder-script/bin` and `coder-script/[script uuid]`. The former is a place for all scripts to place executable binaries that will be available by other scripts, SSH sessions, etc. The latter is a place for the script to store files. Since we default to OS temp dir, files are ephemeral by default. In the future, we may consider adding new env vars or changing the default storage location. Workspace startup speed could potentially benefit from scripts being able to skip steps that require downloading software. We may also extend this with more env variables (e.g. persistent storage in HOME). Fixes #11131
The agent is extended with a `--script-data-dir` flag, defaulting to the OS temp dir. This dir is used for storing `coder-script/bin` and `coder-script/[script uuid]`. The former is a place for all scripts to place executable binaries that will be available by other scripts, SSH sessions, etc. The latter is a place for the script to store files. Since we default to OS temp dir, files are ephemeral by default. In the future, we may consider adding new env vars or changing the default storage location. Workspace startup speed could potentially benefit from scripts being able to skip steps that require downloading software. We may also extend this with more env variables (e.g. persistent storage in HOME). Fixes #11131
The agent is extended with a `--script-data-dir` flag, defaulting to the OS temp dir. This dir is used for storing `coder-script-data/bin` and `coder-script/[script uuid]`. The former is a place for all scripts to place executable binaries that will be available by other scripts, SSH sessions, etc. The latter is a place for the script to store files. Since we default to OS temp dir, files are ephemeral by default. In the future, we may consider adding new env vars or changing the default storage location. Workspace startup speed could potentially benefit from scripts being able to skip steps that require downloading software. We may also extend this with more env variables (e.g. persistent storage in HOME). Fixes #11131
For v1, I only implemented two env variables, For now, these are ephemeral via I also decided that all modules share one bin path because otherwise we have 1-2 problems:
(The Here's an example of a compatibility layer we can use in our scripts: #!/bin/sh
BIN_DIR=/usr/local/bin
if [ -n "${CODER_SCRIPT_BIN_DIR}" ]; then
BIN_DIR="${CODER_SCRIPT_BIN_DIR}"
fi
install_bin() {
name=$(basename "${1}")
echo "Installing ${name} to ${BIN_DIR}..."
cp -f "${1}" "${BIN_DIR}/" || sudo cp -f "${1}" "${BIN_DIR}/"
chmod +x "${BIN_DIR}/${name}"
}
install_bin vault-v1.0.0/bin/vault |
The next step would be refactor modules to make use of this new capabilities. |
@mafredri Is there a way to programatically get the bin dir? For example, on Windows it may be different. |
I guess all scripts would break on windows unless they are windows-specific |
This is an alternate path to achieving
PATH
manipulations as discussed in: #10166The 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:Or let's say
$HOME
isn't writable, we can usually default to theagent
directory often located in/tmp
(granted, this is ephemeral storage, so a warning may be prudent).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.The text was updated successfully, but these errors were encountered: