rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[Rush] Allow commands to have fallbacks for build cache read

Open dmichon-msft opened this issue 3 years ago • 3 comments

Summary

Allows custom bulk script commands to specify fallback alternatives for build cache reads. For example a command "build-incremental" might fall back to "build".

Allows custom parameters to specify that they can be ignored when reading from the build cache. For example a parameter "--no-test" could be ignored when restoring from cache.

Details

Couples the command schemas somewhat more strongly with the concept of the build cache, in order to allow for fallback keys for cache reads.

How it was tested

Modified the local command-line.json to have a command build-incremental that falls back to build, and make the --no-color flag have ignoreForCacheRead: true. Verified that rush build-incremental --no-color could be satisifed by the cache entry created by rush build.

dmichon-msft avatar Sep 08 '21 21:09 dmichon-msft

I'd love to see this draft move forward.

Our scenario: there's a team in our monorepo that would like to use https://rushjs.io/pages/advanced/watch_mode/, but it's not tenable today because creating a "build:watch" bulk command means that each morning, every developer has to pull and all of the library changes they pull are not cached in the cloud build cache.

In this monorepo, we have dependencies A -> B -> C -> D -> App. A and B are deep dependencies that the library developers usually, and C and D are the shallow dependencies that the app developers are touching while they touch the App.

We'd like to recommend the developers do this in their terminal windows:

# Terminal 1
rush build:watch --to-except App

# Terminal 2
cd apps/App && heft start

But this approach adds an extra 3-5 minutes compared to their current approach:

# Terminal 1
rush build --to-except App
cd libraries/D && heft build --watch

# Terminal 2
cd apps/App && heft start

elliot-nelson avatar Nov 06 '21 21:11 elliot-nelson

@elliot-nelson , the main reason this is paused is that it gets almost completely obviated by phased commands, assuming that your build:watch command does a strict subset of the phases executed by build. I have a discussion issue regarding possible other optimizations to the interaction between the build cache and the scheduling engine at #3029.

dmichon-msft avatar Nov 24 '21 03:11 dmichon-msft

Note: PR #3337 has renamed our GitHub master branch to main. This should not affect your pull request, but we recommend to redo your git clone to avoid confusion with the old branch name.

iclanton avatar Apr 09 '22 02:04 iclanton