rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush] additionalProjectsToInclude not working anymore at rush deploy

Open apendua opened this issue 9 months ago • 4 comments

Summary

As per:

https://rushjs.io/pages/configs/deploy_json/

the additionalProjectsToInclude property can be used to include additional projects in the deployment, even if they're not strict dependencies of the projects to be deployed as specified via --project parameter. However, this doesn't seem to work with the recent versions of rush and an attempt to run:

run deploy --project=projectA --scenario=deploy.json

results in an error:

ERROR: Project projectB was not found in the list of projects.

Repro steps

  1. Create rush.json with at least two projects: projectA and projectB, none of which depends on each other.
  2. Define a scenario in deploy.json and specify additionalProjectsToInclude for projectA to include projectB.
  3. Run rush deploy --project=projectA --scenario=deploy.json.
  4. The script will complain that projectB was not found in the list of projects.

Details

I am able to confirm that this functionality is still working in 5.120.5 and it is broken in 5.120.6 where I am getting:

Error: Project projectB was not found in the list of projects.
    at PackageExtractor._performExtractionAsync (/Users/apendua/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/@microsoft/rush/node_modules/@rushstack/package-extractor/lib/PackageExtractor.js:175:31)
    at PackageExtractor.extractAsync (/Users/apendua/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/@microsoft/rush/node_modules/@rushstack/package-extractor/lib/PackageExtractor.js:132:20)
    at async DeployAction.runAsync (/Users/apendua/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/dist/commons.js:8292:9)
    at async RushCommandLineParser.onExecute (/Users/apendua/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/@microsoft/rush/node_modules/@rushstack/ts-command-line/lib/providers/CommandLineParser.js:254:13)
    at async RushCommandLineParser._wrapOnExecuteAsync (/Users/apendua/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/dist/commons.js:5940:9)
    at async RushCommandLineParser.onExecute (/Users/apendua/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/dist/commons.js:5920:13)
    at async RushCommandLineParser.executeWithoutErrorHandling (/Users/apendua/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/@microsoft/rush/node_modules/@rushstack/ts-command-line/lib/providers/CommandLineParser.js:205:13)
    at async RushCommandLineParser.execute (/Users/apendua/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/@microsoft/rush/node_modules/@rushstack/ts-command-line/lib/providers/CommandLineParser.js:98:13)
    at async RushCommandLineParser.execute (/Users/apendua/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/dist/commons.js:5906:16)

Looking at the error stack it seems like the offending commit was:

https://github.com/microsoft/rushstack/commit/a9758226c4e6bb34de31e643a1794288d726d9ab

The process of evaluating projectConfigurations was changed to:

const projects = this._getDependencyProjects(rushConfigurationProject);

not taking into account that some entries may be required via additionalProjectsToInclude. Previously it worked fine because apparently subspace.getProjects() included all necessary projects.

Standard questions

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

Question Answer
@microsoft/rush globally installed version? 5.123.1
rushVersion from rush.json? 5.120.6
useWorkspaces from rush.json? true
Operating system? Mac
Would you consider contributing a PR? Yes
Node.js version (node -v)? 18.18.2

apendua avatar May 08 '24 12:05 apendua

Thanks for reporting this! Looks like it is a regression from the subspaces fix https://github.com/microsoft/rushstack/pull/4655

octogonz avatar May 08 '24 19:05 octogonz

@EscapeB @william2958 FYI

octogonz avatar May 08 '24 19:05 octogonz

Taking a look

william2958 avatar May 08 '24 20:05 william2958

@EscapeB @william2958 FYI

Got it, I think we have found the root cause and are trying to fix that. Didn't realize that there is a field that can add extra entries to package extractor before. In order to support that case, we have to pass all projects and subspaces to PackageExtractor.

EscapeB avatar May 09 '24 06:05 EscapeB

@EscapeB has provided a fix in PR https://github.com/microsoft/rushstack/pull/4693

@william2958

octogonz avatar May 10 '24 06:05 octogonz

🚀 fixed in Rush 5.124.2

octogonz avatar May 10 '24 06:05 octogonz

@EscapeB @william2958 Thank you guys for responding so promptly! I really appreciate this as it was blocking my team from upgrading to the latest version of rush.

apendua avatar May 10 '24 06:05 apendua