Allow usage of several key for cache

Hello,

I have a problem with key of cache, and I didn't find a workaround to do it. My problem is that I would like to cache a directory for the entire repository (aka .m2 for maven) and cache some files only for the current branch. I tried to do the following thing, but it didn't work because it replaces the cache value (keeping only the second):

cache:
paths:
  - test.zip
cache:
    key: "$CI_BUILD_REPO"
    paths:
       - .m2/

It would be nice if we can have several key for different paths in cache, because for now I have to cache .m2 for each branch which wasting disk space. We could do that using the following YAML:

cache:
   - key: "$CI_BUILD_REF"
         - paths:
              - test.zip
   -key: "$CI_BUILD_REPO"
           -paths:
               - .m2/

Thanks.

Edited Jul 15, 2020 by Jason Yavorsky
Assignee Loading
Time tracking Loading