Skip to content

Write .nvmrc for explicit-version Windows CI jobs#32

Open
mokagio wants to merge 2 commits into
mainfrom
mokagio/fix-windows-ci-repo-hook
Open

Write .nvmrc for explicit-version Windows CI jobs#32
mokagio wants to merge 2 commits into
mainfrom
mokagio/fix-windows-ci-repo-hook

Conversation

@mokagio

@mokagio mokagio commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Why

The explicit-version Windows jobs (v20.19.5, v24.15.0) hang and get killed (exit 0xC000013A) — not an assertion failure, a genuine hang. With no .nvmrc in the working directory, nvm v0.39.4's ancestor walk (nvm_find_project_dir) loops forever under the Windows agent's bash. The .nvmrc-fallback Windows job passes precisely because it has a .nvmrc.

This is a CI-harness problem, not a plugin one: the plugin's version:-property path is fine — real consumers that ship a .nvmrc never hit the walk. So the fix stays in CI.

Setting NVM_BUILDKITE_PLUGIN_TEST_NVMRC_VERSION on the explicit-version jobs makes the repo pre-command hook write a .nvmrc before the plugin runs, short-circuiting the walk. The plugin still installs via the version: property; the .nvmrc is only a decoy for nvm's directory search.

No change to hooks/ or plugin.yml.

How to test

Watch the two explicit-version Windows jobs (v20.19.5, v24.15.0) go green. This configuration already passed end-to-end in build 116 (the #29 experiment); this PR lands it as the minimal, clean change.

The Windows explicit-version jobs hang at the nvm installer step, and the
only difference from the passing `.nvmrc` jobs is which branch of this
repository pre-command hook runs: the hanging jobs hit the early
`exit 0`, the passing ones fall through after writing `.nvmrc`. Restructure
so the no-op case falls off the end instead of calling `exit 0`, isolating
whether that explicit exit is what wedges the later `curl | bash`.

If the explicit-version Windows jobs pass after this, version-only on
Windows works and the hang was a harness artifact — no plugin API change
needed.

---

Generated with the help of Claude Code, https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 2, 2026 01:14
@mokagio mokagio self-assigned this Jul 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the Buildkite repository pre-command hook used in CI to avoid an explicit early exit 0, and to only create a .nvmrc file when the CI-only env var is provided—aiming to eliminate a Windows CI hang without changing the plugin’s public behavior.

Changes:

  • Replace the early no-op exit 0 with a conditional write of .nvmrc only when NVM_BUILDKITE_PLUGIN_TEST_NVMRC_VERSION is set.
  • Restructure the hook so the no-op path naturally falls through (no explicit early exit).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +8 to 10
if [[ -n "${NVM_BUILDKITE_PLUGIN_TEST_NVMRC_VERSION:-}" ]]; then
printf '%s\n' "$NVM_BUILDKITE_PLUGIN_TEST_NVMRC_VERSION" > .nvmrc
fi
The explicit-version Windows jobs hang and get killed (`0xC000013A`): with
no `.nvmrc` in the working directory, nvm v0.39.4's ancestor walk loops
forever under the Windows agent's bash. Setting
`NVM_BUILDKITE_PLUGIN_TEST_NVMRC_VERSION` makes the repo `pre-command` hook
write one before the plugin runs, short-circuiting the walk.

The plugin still installs via the `version:` property; the `.nvmrc` is only
there to satisfy nvm's directory walk, so this is a CI-harness fix with no
change to the plugin.

Proven green by build 116 (PR #29 experiment).

---

Generated with the help of Claude Code, https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mokagio mokagio changed the title Drop explicit exit from CI nvmrc repo hook Write .nvmrc for explicit-version Windows CI jobs Jul 2, 2026
Base automatically changed from mokagio/nvm-install-timeout to main July 2, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants