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

Multiple file paths for key caching #45

Open
Tracked by #52
lewis785 opened this issue Jan 28, 2022 · 12 comments
Open
Tracked by #52

Multiple file paths for key caching #45

lewis785 opened this issue Jan 28, 2022 · 12 comments
Labels
enhancement New feature or request

Comments

@lewis785
Copy link

Is it possible to use multiple files for the checksum? I am trying to add caching to a repository that has multiple sub packages and would like the cache to update if any of the package-lock files were change.

Example:

node-cache: &node-cache
    id: node
    key: "v1-cache-{{ id }}-{{ runner.os }}-{{ checksum 'package-lock.json' 'src/example-1/package-lock.json' 'src/example-2/package-lock.json' }}"
    restore-keys:
        - 'v1-cache-{{ id }}-{{ runner.os }}-'
        - 'v1-cache-{{ id }}-'
    paths:
        - node_modules
        - src/**/node_modules

The cache seems to still work but says that it is unable to find the files.

Result:

find: ‘package-lock.json src/example-1/package-lock.json src/example-2/package-lock.json ’: No such file or directory
@gencer gencer added the enhancement New feature or request label Jan 28, 2022
@gencer
Copy link
Collaborator

gencer commented Jan 28, 2022

At the moment, you can either;

  • checksum a single file
  • checksum a whole single folder (recursively)

Multiple files like you described in your example will not work that way. But this can be implemented.

@gencer
Copy link
Collaborator

gencer commented Feb 1, 2022

Hey @lewis785,

I'm doing my own tests on my end. What do you think about the following approaches:

Comma-separated:

node-cache: &node-cache
    id: node
    key: "v1-cache-{{ id }}-{{ runner.os }}-{{ checksum 'package-lock.json,src/example-1/package-lock.json,src/example-2/package-lock.json' }}"

Glob-pattern:

node-cache: &node-cache
    id: node
    key: "v1-cache-{{ id }}-{{ runner.os }}-{{ checksum '**/package-lock.json' }}"

P.S.: This may be miss the main /package-lock.json and only include sub-directories.

Key-based:

node-cache: &node-cache
    id: node
    key: "v1-cache-{{ id }}-{{ runner.os }}-{{ checksum }}" # if no data given, checksum key below will be used:
    checksum: # list of files to get cheksums
      - package-lock.json
      - **/package-lock.json # and glob pattern! or maybe full list of single files...

It seems Key-based is looking good and more fit to the structure.

Any ideas?

@lewis785
Copy link
Author

lewis785 commented Feb 3, 2022

I think the key based approach is the best, it would provide people plenty of flexability. Additionally it keeps it consistent with how multiple paths are defined.

@stale
Copy link

stale bot commented Feb 24, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Feb 24, 2022
@gencer
Copy link
Collaborator

gencer commented Feb 24, 2022

Not stale.

@stale stale bot removed the wontfix This will not be worked on label Feb 24, 2022
@stale
Copy link

stale bot commented Mar 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 17, 2022
@stale stale bot closed this as completed Mar 20, 2022
@gencer gencer reopened this Mar 20, 2022
@stale stale bot removed the wontfix This will not be worked on label Mar 20, 2022
@stale
Copy link

stale bot commented Apr 14, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 14, 2022
@gencer
Copy link
Collaborator

gencer commented Apr 15, 2022

Not stale

@stale stale bot removed the wontfix This will not be worked on label Apr 15, 2022
@stale
Copy link

stale bot commented May 31, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 31, 2022
@gencer
Copy link
Collaborator

gencer commented May 31, 2022

not stale

@stale stale bot closed this as completed Jun 10, 2022
@gencer gencer reopened this Jun 10, 2022
@stale stale bot removed the wontfix This will not be worked on label Jun 10, 2022
@stale
Copy link

stale bot commented Jul 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jul 10, 2022
@gencer
Copy link
Collaborator

gencer commented Jul 21, 2022

Not stale

@stale stale bot closed this as completed Aug 1, 2022
@gencer gencer reopened this Aug 12, 2022
@stale stale bot removed the wontfix This will not be worked on label Aug 12, 2022
@gencer gencer mentioned this issue Aug 29, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants