-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow updating an existing cache #505
Comments
I would also like to support this proposal. |
I need this too |
same |
|
#poke |
+1 |
3 similar comments
+1 |
+1 |
+1 |
In the meantime, here's a workaround that I use: - name: Get cache
uses: actions/cache@v3
with:
path: ... # a list of cache paths
key: ${{ runner.os }}-my-cache-${{ github.head_ref }}-${{ hashFiles(...for example yarn.lock...) }}
- name: Do something to change a cache
run: ...
- name: Enforce cache update for a local NX cache
run: |
STATE_CACHE_KEY="${{ runner.os }}-my-cache-${{ github.head_ref }}-${{ hashFiles(...) }}"
echo "STATE_CACHE_KEY=${STATE_CACHE_KEY}" >> $GITHUB_ENV |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
Updating the cache is supposed to be done with restore-keys This input allows to restore the cache even if it is not fully matched. And to generate the new key to update the cache do one of:
|
@dsame's workaround is the best available currently, though it does have problems. Github hard-limits repos to 10GB of caches. So creating lots of caches can push other less-frequent-but-helpful caches to deletion. Whereas if you could update/replace an existing cache, that wouldn't happen. |
CI: split pkg build and update w/ iso ntfs3 patches from paragon group (unupstream) openseachest: use upstream pull script install pkgs single-branch add artifacts ignore error for make all step to get log artifacts china timezone linux: merge linux 6.1 update grub2 to latest remove grub2 single job * this is leftover of previous bash-based build script add iso and update chksum files use latest pip packages * pin jsonschema due to schema exception CI: use git from Ubuntu PPA git: depth 1 prepend sudo to cmdline show info after build CI: 8G root; 10G swap + 7G mem = 17G update smartmontools to 7.3 CI: reclaim disk space truenas/zfs@165d115 CI: do not run in the background CI: setup-python github action uses this dir CI: only use setup-python for scale-build do NOT set PYTHON env CI: add comments and echoes disable packages with '-dbg' by removing them from manifest scst: back to official after cleanup dbg pkgs copy manifest from update dir use python 3.11 do NOT show kernel config changes CI: exclude ccache dir CI: use sudo for commands on GH CI: exclude scale-build repo hash from cache key calculation also takes conf manifest into consideration CI: set permission for tmp CI: cache rootfs and iso chroot output flag on whether rootfs and iso chroot cache is usable to /tmp add subpkg to build grub-efi-amd64-signed when we are using customized grub CI: always upload cache when success build CI: use unversioned cache delete old one if we can upload new(update existing cache is not possible) actions/toolkit#505
CI: split pkg build and update w/ iso ntfs3 patches from paragon group (unupstream) openseachest: use upstream pull script install pkgs single-branch add artifacts ignore error for make all step to get log artifacts china timezone linux: merge linux 6.1 update grub2 to latest remove grub2 single job * this is leftover of previous bash-based build script add iso and update chksum files use latest pip packages * pin jsonschema due to schema exception CI: use git from Ubuntu PPA git: depth 1 prepend sudo to cmdline show info after build CI: 8G root; 10G swap + 7G mem = 17G update smartmontools to 7.3 CI: reclaim disk space truenas/zfs@165d115 CI: do not run in the background CI: setup-python github action uses this dir CI: only use setup-python for scale-build do NOT set PYTHON env CI: add comments and echoes disable packages with '-dbg' by removing them from manifest scst: back to official after cleanup dbg pkgs copy manifest from update dir use python 3.11 do NOT show kernel config changes CI: exclude ccache dir CI: use sudo for commands on GH CI: exclude scale-build repo hash from cache key calculation also takes conf manifest into consideration CI: set permission for tmp CI: cache rootfs and iso chroot output flag on whether rootfs and iso chroot cache is usable to /tmp add subpkg to build grub-efi-amd64-signed when we are using customized grub CI: always upload cache when success build CI: use unversioned cache delete old one if we can upload new(update existing cache is not possible) actions/toolkit#505
CI: split pkg build and update w/ iso ntfs3 patches from paragon group (unupstream) openseachest: use upstream pull script install pkgs single-branch add artifacts ignore error for make all step to get log artifacts china timezone linux: merge linux 6.1 update grub2 to latest remove grub2 single job * this is leftover of previous bash-based build script add iso and update chksum files use latest pip packages * pin jsonschema due to schema exception CI: use git from Ubuntu PPA git: depth 1 prepend sudo to cmdline show info after build CI: 8G root; 10G swap + 7G mem = 17G update smartmontools to 7.3 CI: reclaim disk space truenas/zfs@165d115 CI: do not run in the background CI: setup-python github action uses this dir CI: only use setup-python for scale-build do NOT set PYTHON env CI: add comments and echoes disable packages with '-dbg' by removing them from manifest scst: back to official after cleanup dbg pkgs copy manifest from update dir use python 3.11 do NOT show kernel config changes CI: exclude ccache dir CI: use sudo for commands on GH CI: exclude scale-build repo hash from cache key calculation also takes conf manifest into consideration CI: set permission for tmp CI: cache rootfs and iso chroot output flag on whether rootfs and iso chroot cache is usable to /tmp add subpkg to build grub-efi-amd64-signed when we are using customized grub CI: always upload cache when success build CI: use unversioned cache delete old one if we can upload new(update existing cache is not possible) actions/toolkit#505
On Gitlab or a lot of other different CI/CD tools, this is built-in 😭 Such a pain not to have this! |
I came across this documentation that uses artifacts across workflow runs as a workaround for this: https://github.com/renovatebot/github-action?tab=readme-ov-file#persisting-the-repository-cache |
I have tried several workarounds to get I have a matrix job that creates test results for a dozen different features. Each job in the matrix uploads its test results with:
After the matrix job there comes another job that aggregates all test results into one single folder:
After that you could just use Optional: Since the individual artifacts are now obsolete you can perform a cleanup operation with:
|
+8 |
+9. Need this to cache a vulnerability database to improve the performance and reliability of our CI workflow. |
Using less specific key for loading cache than for saving (e.g. Cache can currently be restored from the default branch - that allows use of cache for newly created PRs and branches from the start. Updating an existing cache would require removal of that feature because e.g. updating cache in third party PR and using it on master would eventually result in bad consequences. Problem is that it is not explained in the documentation. Secondary, cache size is limited and there is no way how to remove less useful and outdated cache that is likely to be never used again, causing more useful cache to be deleted. Also having a button for deleting all the cache would be quite helpful for debugging cache-related issues. |
GitHub actions supports caching across builds which is super powerful. However, once a cache has been saved it can no longer be modified. While this is fine for most scenarios where you need the cache there are a few times when you would like to update it.
I created this PR on the actual cache action to allow updating a cache when providing it in configuration:
actions/cache#353
I created it after reading the related issue:
actions/cache#342
However, it seems like something either needs to change in this package or server-side on the actions cache.
My use-case for wanting to update a cache is when using GitHub actions in golang projects. Go supports a test cache which allows tests to be skipped if the code they use has not changed, which can significantly improve test times (especially in large projects). Each time I run my tests, I'd like to maintain a single cache for tests, that way, when a run completes I can update the cache and all my workflows share a single test cache
There are some extra use-cases described on the issue above.
The text was updated successfully, but these errors were encountered: