Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rush] phased command not work correct with upstream #3753

Closed
yoyo930021 opened this issue Nov 16, 2022 · 2 comments · Fixed by #3754
Closed

[rush] phased command not work correct with upstream #3753

yoyo930021 opened this issue Nov 16, 2022 · 2 comments · Fixed by #3754

Comments

@yoyo930021
Copy link
Contributor

Summary

I want to have a command for run upstream project build and self project lint without self project build.
But when I try to set it, I only get a command for for run upstream project build and self project lint and self project build.

Repro steps

Clone this project: https://github.com/yoyo930021/rush-upstream-phase-bug

rush install
rush lint

Expected result:
only run 3 operations
project (lint)
upstream (build)
upstream (lint)

Actual result:
run 4 operations
project (lint)
upstream (build)
upstream (lint)
project (build)

Details

In this line, project will add any phase with selection project.
https://github.com/microsoft/rushstack/blob/main/libraries/rush-lib/src/logic/operations/PhasedOperationPlugin.ts#L40

Standard questions

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

Question Answer
@microsoft/rush globally installed version? 5.83.3
rushVersion from rush.json? 5.83.3
useWorkspaces from rush.json? true
Operating system? Mac
Would you consider contributing a PR? Yes
Node.js version (node -v)? 16.16.0
@dmichon-msft
Copy link
Contributor

This is a change to the specification of how phased commands work. The current design is:

  1. Rush evaluates the set of phases that are involved in your command in isolation to detect the full set of phases to include
  2. Rush evaluates the set of projects in isolation to determine the full set of projects to include
  3. For all selected projects, Rush includes all selected phases in the build graph

The ask here is to have rush test run _phase:test in all selected projects and do whatever minimal set of supporting operations are necessary to make that happen.

There's a further level of redesign I've been considering which is to be able to ask Rush to run _phase:test in a specified target project, and do all necessary supporting operations to make that happen. Ultimately the problem comes down to that phase selection is performed by the command definition, and the command line only allows selecting projects, we don't have a CLI mechanism to specify both target phases and target projects.

@yoyo930021
Copy link
Contributor Author

yoyo930021 commented Nov 17, 2022

Do we have full specification of this? I only see document and #2300 .
I literally think that the current behavior is unreasonable.

{
  "commandKind": "phased",
  "name": "test",
  "phases": ["_phase:build", "_phase:test"],
}

When we use rush test command, we choose two "_phase:build", "_phase:test" phase, the dependency is not my chosen.
But the https://github.com/microsoft/rushstack/blob/main/libraries/rush-lib/src/logic/operations/PhasedOperationPlugin.ts#L75-L81 more like a white list of phase.
I think the two actually do not conflict.

@iclanton iclanton moved this to Closed in Bug Triage Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants