[ENG-9500] Implement save-cache and restore-cache functions
Why
User should be able to save and restore files in their custom builds as steps.
This is part 1 of this feature. It provides two new custom build functions: eas/save-cache and eas/restore-cache.
build:
name: Foobar
steps:
- eas/checkout
- eas/restore-cache:
inputs:
key: cache-key
paths: node_modules
- eas/install_node_module
- eas/save-cache:
inputs:
key: cache-key
paths: node_modules
Future PR will allow passing lists of files to paths parameter and define dynamic cache-key.
How
This PR implements eas/reastore-cache and eas/save-cache functions and lays foundations for future PRs.
Cache type is enhanced with downloadUrls attribute which will store mappings between cache keys and signed urls with cached files. Field will be populated by launcher.
CacheManager now accepts two parameters: build context (which is either BuildStepContext or BuildContext<Job>) and Cache. Implementation of CacheManager using dynamic cache urls will be provided in future PRs. Until this happens, for compatibility, build context is using any type.
Test Plan
These changes are not meant to provide working functionality, but to provide foundation for new GCSCacheManager implementation.
Codecov Report
Attention: Patch coverage is 90.72165% with 9 lines in your changes are missing coverage. Please review.
Project coverage is 91.43%. Comparing base (
74d8c65) to head (db0ebe4). Report is 2 commits behind head on main.
:exclamation: Current head db0ebe4 differs from pull request most recent head fdb4f77. Consider uploading reports for the commit fdb4f77 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## main #289 +/- ##
==========================================
+ Coverage 88.51% 91.43% +2.92%
==========================================
Files 23 23
Lines 1114 1085 -29
Branches 247 229 -18
==========================================
+ Hits 986 992 +6
+ Misses 128 93 -35
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@sjchmiela