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] Install can't be skipped with useWorkspaces and git checkout #2371

Closed
buffaybu opened this issue Nov 24, 2020 · 3 comments
Closed

[rush] Install can't be skipped with useWorkspaces and git checkout #2371

buffaybu opened this issue Nov 24, 2020 · 3 comments
Labels
effort: medium Needs a somewhat experienced developer enhancement The issue is asking for a new feature or design change

Comments

@buffaybu
Copy link

buffaybu commented Nov 24, 2020

Summary

With Gitlab CI, I try to skip install by marking common/temp as cache but install still runs.

Repro steps

In a rush repo,

  1. git checkout A
  2. rush install
  3. git checkout B
  4. touch some/project/package.json
  5. git checkout A
  6. rush install

Expected result:

Don't run the second install.

Actual result:

The second install runs.

Details

canSkipInstall compares mtime of common/temp/last-install.flag and each project's package.json (#2029).

common/temp/last-install.flag's mtime is preserved because of cache, but mtime of each project's package.json is not preserved by git checkout so it can be more recent than flag's even though the file content remains the same, and that the install step won't be skipped.

Although all the packages are reused, the install step still takes tens of seconds.

Maybe keeping MD5 hash of package.json in the flag file or somewhere else will fix this.

Standard questions

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

Question Answer
@microsoft/rush globally installed version? 5.35.2
rushVersion from rush.json? 5.35.2
useWorkspaces from rush.json? Yes
Operating system? Mac
Would you consider contributing a PR? Yes
Node.js version (node -v)? 14.15.0
@iclanton iclanton added effort: medium Needs a somewhat experienced developer enhancement The issue is asking for a new feature or design change labels Nov 30, 2020
@iclanton
Copy link
Member

Maybe keeping MD5 hash of package.json in the flag file or somewhere else will fix this.

I like this idea. @D4N14L is the expert on this feature, if he wants to weigh in.

@buffaybu - would you be interested in contributing this feature?

@D4N14L
Copy link
Member

D4N14L commented May 11, 2021

Git sets the current time as the timestamp on every file it modifies, but only those. The other files are left untouched, which means build tools will be able to depend on modification time and rebuild properly. If build rules change, that can cause a failure anyway, but that is a far less common problem than accidentally not rebuilding.

This seems to imply that things are working as expected as-is? If the file is modified, git will refresh it with the one from the branch you changed to and set the modified time to the current time. If the file isn't modified, it should not get touched.

@D4N14L
Copy link
Member

D4N14L commented May 11, 2021

I'm going to close this out seeing as:

  • it appears we are using the modified time as expected according to Git spec
  • if you have knowledge of which projects need to be installed, you can perform a filtered install in workspaces mode (workspaces will likely become the default for Rush in PNPM in future major versions of Rush)

Feel free to re-open if you disagree :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium Needs a somewhat experienced developer enhancement The issue is asking for a new feature or design change
Projects
Archived in project
Development

No branches or pull requests

3 participants