Skip to content

Commit 8c130bc

Browse files
fix(opencode): pass VERSION to bash instead of curl in install pipe (#815)
## Summary - Fix version pinning bug in the OpenCode install script (`registry/coder-labs/modules/opencode/scripts/install.sh`, line 42) **Bug:** The install command was: ```bash VERSION=$ARG_OPENCODE_VERSION curl -fsSL https://opencode.ai/install | bash ``` `VERSION` was set as an environment variable prefix to `curl` (the left side of the pipe), so the `bash` process on the right side of the pipe never received it. In a shell pipeline, each command runs in its own subprocess, so env var prefixes only apply to the immediately following command. This caused the installer script to always install the latest version instead of the pinned version specified by the user. **Fix:** Move `VERSION` to prefix `bash` instead of `curl`: ```bash curl -fsSL https://opencode.ai/install | VERSION=$ARG_OPENCODE_VERSION bash ``` Now the `VERSION` variable is correctly available to the install script executed by `bash`. ## Test plan - [x] Set `opencode_version` to a specific version (e.g., `0.1.0`) and verify that version is installed instead of latest - [x] Set `opencode_version` to `latest` and verify the latest version is still installed (this code path is unchanged) - [x] Verify `opencode --version` output matches the requested version after install --------- Co-authored-by: 35C4n0r <70096901+35C4n0r@users.noreply.github.com>
1 parent 516b9ce commit 8c130bc

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

registry/coder-labs/modules/opencode/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run [OpenCode](https://opencode.ai) AI coding assistant in your workspace for in
1313
```tf
1414
module "opencode" {
1515
source = "registry.coder.com/coder-labs/opencode/coder"
16-
version = "0.1.1"
16+
version = "0.1.2"
1717
agent_id = coder_agent.main.id
1818
workdir = "/home/coder/project"
1919
}
@@ -34,7 +34,7 @@ resource "coder_ai_task" "task" {
3434
3535
module "opencode" {
3636
source = "registry.coder.com/coder-labs/opencode/coder"
37-
version = "0.1.1"
37+
version = "0.1.2"
3838
agent_id = coder_agent.main.id
3939
workdir = "/home/coder/project"
4040
@@ -89,7 +89,7 @@ Run OpenCode as a command-line tool without web interface or task reporting:
8989
```tf
9090
module "opencode" {
9191
source = "registry.coder.com/coder-labs/opencode/coder"
92-
version = "0.1.1"
92+
version = "0.1.2"
9393
agent_id = coder_agent.main.id
9494
workdir = "/home/coder"
9595
report_tasks = false

registry/coder-labs/modules/opencode/scripts/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ install_opencode() {
3939
if [ "$ARG_OPENCODE_VERSION" = "latest" ]; then
4040
curl -fsSL https://opencode.ai/install | bash
4141
else
42-
VERSION=$ARG_OPENCODE_VERSION curl -fsSL https://opencode.ai/install | bash
42+
curl -fsSL https://opencode.ai/install | VERSION="${ARG_OPENCODE_VERSION}" bash
4343
fi
4444
export PATH=/home/coder/.opencode/bin:$PATH
4545
printf "Opencode location: %s\n" "$(which opencode)"

0 commit comments

Comments
 (0)