Skip to content

fix(opencode): pass VERSION to bash instead of curl in install pipe - #815

Merged
35C4n0r merged 5 commits into
coder:mainfrom
megheaiulian:fix/opencode-version-pinning
Mar 27, 2026
Merged

35C4n0r merged 5 commits into
coder:mainfrom
megheaiulian:fix/opencode-version-pinning

Conversation

@megheaiulian

@megheaiulian megheaiulian commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

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:

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:

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

  • Set opencode_version to a specific version (e.g., 0.1.0) and verify that version is installed instead of latest
  • Set opencode_version to latest and verify the latest version is still installed (this code path is unchanged)
  • Verify opencode --version output matches the requested version after install

@matifali

Copy link
Copy Markdown
Member

Thanks for the fix.

@matifali
matifali requested a review from 35C4n0r March 26, 2026 10:19
Comment thread registry/coder-labs/modules/opencode/scripts/install.sh Outdated
megheaiulian and others added 2 commits March 26, 2026 13:56
Co-authored-by: 35C4n0r <70096901+35C4n0r@users.noreply.github.com>
@35C4n0r

35C4n0r commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

@megheaiulian can you do a git pull and run ./.github/scripts/version-bump.sh patch + push. We need this to update the opencode module version.

@35C4n0r 35C4n0r added the version:patch Add to PRs requiring a patch version upgrade label Mar 27, 2026
@35C4n0r

35C4n0r commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

@megheaiulian workflows fail, can you run bun fmt and push again.

@35C4n0r 35C4n0r added version:patch Add to PRs requiring a patch version upgrade and removed version:patch Add to PRs requiring a patch version upgrade labels Mar 27, 2026

@35C4n0r 35C4n0r left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@megheaiulian thanks for the contribution. LGTM!

@35C4n0r
35C4n0r merged commit 8c130bc into coder:main Mar 27, 2026
5 checks passed
@megheaiulian
megheaiulian deleted the fix/opencode-version-pinning branch March 27, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

version:patch Add to PRs requiring a patch version upgrade

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants