Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion registry/coder/modules/devcontainers-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The devcontainers-cli module provides an easy way to install [`@devcontainers/cl
```tf
module "devcontainers-cli" {
source = "registry.coder.com/coder/devcontainers-cli/coder"
version = "1.0.31"
version = "1.0.32"
agent_id = coder_agent.example.id
}
```
4 changes: 4 additions & 0 deletions registry/coder/modules/devcontainers-cli/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ const executeScriptInContainerWithPackageManager = async (

console.log(path);

await execContainer(id, [shell, "-c", "mkdir -p /tmp/coder-script-data"]);

const resp = await execContainer(
id,
[shell, "-c", instance.script],
[
"--env",
"CODER_SCRIPT_BIN_DIR=/tmp/coder-script-data/bin",
"--env",
"CODER_SCRIPT_DATA_DIR=/tmp/coder-script-data",
"--env",
`PATH=${path}:/tmp/coder-script-data/bin`,
],
);
Expand Down
5 changes: 4 additions & 1 deletion registry/coder/modules/devcontainers-cli/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ install() {
fi
pnpm add -g @devcontainers/cli
elif [ "$PACKAGE_MANAGER" = "yarn" ]; then
yarn global add @devcontainers/cli --prefix "$(dirname "$CODER_SCRIPT_BIN_DIR")"
# We want to cd into `$CODER_SCRIPT_DATA_DIR` as the current directory
# might contain a `package.json` with `packageManager` set to something
# other than `yarn`. When this happens, `yarn global add` will fail to install.
cd "$CODER_SCRIPT_DATA_DIR" && yarn global add @devcontainers/cli --prefix "$(dirname "$CODER_SCRIPT_BIN_DIR")"
fi
}

Expand Down