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] Use a local filesystem build cache in addition to a cloud build cache if one is configured. #2404

Merged

Conversation

iclanton
Copy link
Member

@iclanton iclanton commented Dec 22, 2020

This is one of the TODO items listed in #2393 (comment)

This change:

  • Renames the "filesystem" build cache option to "local-only"
  • Updates the way the build cache configuration is loaded to always initialize a local filesystem cache provider and conditionally initialize a second "cloud" cache provider if one is configured in /common/config/rush/build-cache.json
  • Changes the way reading from cache works to
    1. Try to get from local cache
    2. If getting data from local cache was unsuccessful, query cloud cache, if one is configured
    3. If getting data from cloud cache was successful, write it back to local cache
    4. If getting data from either cache was successful, restore to the project folder
  • Changes the way writing to cache works to
    1. Write to local cache
    2. If a writable cloud cache is configured, write to it

Testing Notes

The following scenarios were tested:

  • "cacheProvider" set to "local-only"
    • With cache cleared, a build adds cache entries
    • With cache filled, a build skips all projects and gets output from cache
    • With cache partially filled, missing entries are added and cached projects are skipped
  • "cacheProvider" set to "azure-blob-storage" and with "isCacheWriteAllowed" set to false
    • Local cache is filled from Azure Storage and build is skipped
    • Errors are printed if there is no network connectivity
    • Local cache is filled with uncached projects
  • "cacheProvider" set to "azure-blob-storage" and with "isCacheWriteAllowed" set to true
    • All behavior is the same as above, except that cloud cache is filled with uncached projects.

@iclanton iclanton changed the title [rush-lib] Use a local filesystem build cache in addition to a cloud build cache if one is configured. [rush] Use a local filesystem build cache in addition to a cloud build cache if one is configured. Dec 22, 2020
@octogonz
Copy link
Collaborator

With your design, how do we configure writing to the cloud cache?

Scenario 1: Team members can read from the cloud cache, but writing to the cloud cache can only be performed by a CI job.

Scenario 2: Team members can read AND write to the cloud cache.

@iclanton
Copy link
Member Author

Scenario 1: Team members can read from the cloud cache, but writing to the cloud cache can only be performed by a CI job.

You'd set the "isCacheWriteAllowed" property to false in the common/config/rush/build-cache.json file, and then the CI agent would specify a SAS in the RUSH_BUILD_CACHE_CREDENTIAL environment variable.

Scenario 2: Team members can read AND write to the cloud cache.

You'd just set "isCacheWriteAllowed" to true (and make sure your users have write permissions).

@iclanton iclanton force-pushed the ianc/drop-filesystem-cache-provider branch from 7f3581c to eaa0fa4 Compare December 25, 2020 08:02
@iclanton iclanton force-pushed the ianc/drop-filesystem-cache-provider branch from eaa0fa4 to 4037910 Compare December 29, 2020 03:17
@octogonz
Copy link
Collaborator

Can you add test notes detailing the scenarios that you tested? (e.g. missing network connection, expired token, etc)

Co-authored-by: Pete Gonzalez <[email protected]>
@iclanton iclanton merged commit 46120de into microsoft:master Dec 29, 2020
@iclanton iclanton deleted the ianc/drop-filesystem-cache-provider branch December 29, 2020 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants