Skip to content

fix: bootstrap rush/autorest prerequisites in GenerateModules.ps1 for fresh clones#3653

Open
ramsessanchez wants to merge 1 commit into
mainfrom
fix/generateModulesPrereqBootstrap
Open

fix: bootstrap rush/autorest prerequisites in GenerateModules.ps1 for fresh clones#3653
ramsessanchez wants to merge 1 commit into
mainfrom
fix/generateModulesPrereqBootstrap

Conversation

@ramsessanchez

Copy link
Copy Markdown
Contributor

Problem

Running tools/GenerateModules.ps1 on a fresh clone fails at:

Command 'npx --no-install rush install' failed with exit code 1.

npx --no-install resolves rush/autorest only from the repo-root node_modules, which does not exist on a fresh local clone. CI is unaffected because .azure-pipelines/common-templates/install-tools.yml installs these packages first, which masked the gap for local runs.

Changes

  • Idempotent Node build-tools bootstrap in GenerateModules.ps1: installs @microsoft/rush, autorest@3.7.2 and @autorest/core@3.10.4 at the repo root only when the executables are missing (same versions as install-tools.yml).
  • Fail-fast submodule check: throws a clear git submodule update --init --recursive message if autorest.powershell/rush.json is absent, instead of a cryptic rush error.
  • .gitignore: ignore the npm-generated root package.json / package-lock.json.

Azure DevOps impact: none

The bootstrap is guarded by a presence check. In ADO the packages are already installed at the build sources directory, so the step is skipped - no new npm calls (safe for network-isolated release pipelines) and CI behavior is identical.

Validation

  • Fresh-clone path (no node_modules): installs tools, rush/autorest bins present, rush install then succeeds.
  • Re-run / ADO path (tools present): bootstrap skipped.
  • Missing-submodule path: throws the actionable error.
  • Script parses with 0 errors; generated package.json/node_modules confirmed git-ignored.

GenerateModules.ps1 invokes rush and autorest via 'npx --no-install', which
only resolves them from the repo-root node_modules. On a fresh clone that
directory does not exist, so the script failed with 'could not determine
executable to run'. CI worked because install-tools.yml installs these
packages, masking the gap for local runs.

- Add an idempotent bootstrap that installs @microsoft/rush, autorest@3.7.2
  and @autorest/core@3.10.4 at the repo root only when the executables are
  missing. In Azure DevOps the packages are already present, so the step is
  skipped and CI behavior is unchanged.
- Add a fail-fast check for the autorest.powershell submodule (rush.json) with
  a clear 'git submodule update --init --recursive' instruction.
- Ignore the npm-generated root package.json/package-lock.json.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ramsessanchez ramsessanchez requested a review from a team as a code owner June 30, 2026 23:46
@Joywambui-maina

Copy link
Copy Markdown

Works locally on my end.

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