eas-build icon indicating copy to clipboard operation
eas-build copied to clipboard

[ENG-9500] Implement save-cache and restore-cache functions

Open khamilowicz opened this issue 2 years ago • 3 comments

Why

ENG-9500

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.

khamilowicz avatar Nov 14 '23 11:11 khamilowicz

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

Files Patch % Lines
packages/steps/src/cli/cli.ts 0.00% 3 Missing :warning:
packages/steps/src/inputFunctions.ts 86.37% 3 Missing :warning:
packages/steps/src/BuildStepInput.ts 93.11% 2 Missing :warning:
packages/steps/src/utils/template.ts 96.43% 1 Missing :warning:
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.

codecov[bot] avatar Nov 14 '23 11:11 codecov[bot]

@sjchmiela

khamilowicz avatar Mar 18 '24 14:03 khamilowicz