microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.74k stars 587 forks source link

[rush] 5.126.0+ fails to get git config on `rush install` #4777

Closed pwbriggs closed 3 weeks ago

pwbriggs commented 3 weeks ago

Summary

We use a GitHub Actions workflow in our repo to check that the shrinkwrap is in sync with our package.json files. The script runs rush install --check-only. However, since Rush 5.126.0, the command has been failing, saying

Unable to determine your Git configuration using this command:

    git config user.email

Repro steps

👉 Repository available at Sorry, this issue is fixed so I deleted the repo. Here's the example worklow I was using, for historical purposes:

Example workflow ```yml name: Verify Rush shrinkwrap is up to date on: - pull_request - push jobs: check-shrinkwrap: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4.1.6 - name: Check shrinkwrap with Rush run: node common/scripts/install-run-rush.js --debug install --check-only ```
  1. rush init
  2. run rush update to create scriptsThe common/scripts directory is not included in rush init.
  3. add a project so rush install works properlyrush install will complain if there's no dependencies & thus no shrinkwrap.
  4. add a workflow that uses rush installSee the specific workflow I'm using above.
  5. upgrade rushVersion to 5.125.1✅ This is the last working version.
  6. upgrade rushVersion to 5.126.0❌ CI fails on this one for unclear reasons.

    Expected result: rush install should work in CI without Git configured.

    Actual result:

    Error: Process exited with code 1 Unable to determine your Git configuration using this command:

    git config user.email

    Error: An error occurred. at Git.tryGetGitEmailAsync (/home/runner/work/rush-repro/rush-repro/common/temp/install-run/@microsoft+rush@5.126.0/node_modules/@microsoft/rush-lib/dist/commons.js:13806:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Module.validateAsync (/home/runner/work/rush-repro/rush-repro/common/temp/install-run/@microsoft+rush@5.126.0/node_modules/@microsoft/rush-lib/dist/commons.js:23135:21) at async Module.validatePolicyAsync (/home/runner/work/rush-repro/rush-repro/common/temp/install-run/@microsoft+rush@5.126.0/node_modules/@microsoft/rush-lib/dist/commons.js:23255:9) at async WorkspaceInstallManager.prepareAsync (/home/runner/work/rush-repro/rush-repro/common/temp/install-run/@microsoft+rush@5.126.0/node_modules/@microsoft/rush-lib/dist/chunks/InstallManagerFactory.js:486:9) at async WorkspaceInstallManager.doInstallAsync (/home/runner/work/rush-repro/rush-repro/common/temp/install-run/@microsoft+rush@5.126.0/node_modules/@microsoft/rush-lib/dist/chunks/InstallManagerFactory.js:363:83) at async WorkspaceInstallManager.doInstallAsync (/home/runner/work/rush-repro/rush-repro/common/temp/install-run/@microsoft+rush@5.126.0/node_modules/@microsoft/rush-lib/dist/chunks/InstallManagerFactory.js:1355:9) at async InstallAction._doInstallAsync (/home/runner/work/rush-repro/rush-repro/common/temp/install-run/@microsoft+rush@5.126.0/node_modules/@microsoft/rush-lib/dist/commons.js:7328:9) at async InstallAction.runAsync (/home/runner/work/rush-repro/rush-repro/common/temp/install-run/@microsoft+rush@5.126.0/node_modules/@microsoft/rush-lib/dist/commons.js:7303:17) at async RushCommandLineParser.onExecute (/home/runner/work/rush-repro/rush-repro/common/temp/install-run/@microsoft+rush@5.126.0/node_modules/@rushstack/ts-command-line/lib/providers/CommandLineParser.js:268:13)

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? none; using install-run-rush.js in CI
rushVersion from rush.json? 5.126.0
useWorkspaces from rush.json? Can't find that in my rush.json..?
Operating system? Linux
Would you consider contributing a PR? Yes
Node.js version (node -v)? 18.20.3
kamontat commented 3 weeks ago

@pwbriggs I created fix on #4772. Waiting for contributors to approve.