You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cache doesn't work with github workspace directory #833
Thank you for the report. I was able to reproduce this. From the first look, it appears that there is a bug while converting the cache paths to relative paths for compression in the toolkit. I will debug the cause and get back.
It doesn't seems to be fixed for some reason :/
I've tested with actions/cache@v3.0.1 both the two version with . and env variable and it still cache 22B @pdotl
Hi @erwan-joly , the above version is for actions/cache npm module and not for the actions/cache action. We are yet to merge toolkit changes into the actions/cache. Once done, you should be able to test and use the same. I'll post an update here once done.
My build job relies on ${{ github.workspace }} to output its result and I want to cache this result and restore it in my publish job. Here is how I made this works:
name: Buildon:
push:
tags:
- '*'workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latestcontainer:
image: mstorsjo/llvm-mingw:lateststeps:
- name: build stuffrun: | echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" echo "github.workspace=${{ github.workspace }}" # echo curent working dir which is $GITHUB_WORKSPACE and not ${{ github.workspace }}. echo "current working dir:" pwd # cd to build dir. # for the example, creates a my_build_dir and cd to it. cd my_build_dir # run build command that generates the buil result in ${{ github.workspace }}/output. # for the example, creates the output dir and touch a result.out file in it. mkdir -p ${{ github.workspace }}/output touch ${{ github.workspace }}/output/result.out # back to $GITHUB_WORKSPACE cd .. cp -r ${{ github.workspace }}/output $GITHUB_WORKSPACE ls -l $GITHUB_WORKSPACE
- name: Cache build outputid: cache-save-build-ouputuses: actions/cache/save@v3with:
path: | ./outputkey: ${{ runner.os }}-build-output-run_${{ github.run_id }}enableCrossOsArchive: truepublish:
runs-on: ubuntu-latestimage: mstorsjo/llvm-mingw:latestneeds: buildsteps:
- name: Restore build ouput cacheuses: actions/cache/restore@v3id: cache-restore-build-ouputwith:
path: | ./outputkey: ${{ runner.os }}-build-output-run_${{ github.run_id }}enableCrossOsArchive: truefail-on-cache-miss: true
- name: archiverun: | echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" echo "github.workspace=${{ github.workspace }}" # echo curent working dir which is $GITHUB_WORKSPACE and not ${{ github.workspace }}. echo "current working dir:" pwd echo "restored cache output dir:" ls -l ./ouput
Note that restoring a cache in a container image different from the one that saved the cache may fail because the comrpession tool (tar) may be different. For example using image: alpine:latest container in my publish job fails this way:
/bin/tar: unrecognized option: P
On the other hand, using no container on the my publish job fails this way:
##[debug]No matching cache found for cache key 'Linux-build-output-run_4252492458', version '864e6dbc1f60e04c96ce9a7e3cc1dc27a256109377aae3de699034043992ea42 and scope refs/tags/v4.2.1-full. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
##[debug]Other caches with similar key:
##[debug]Cache Key: Linux-build-output-run_4252492[45](https://github.com/khelkun/ffmpeg-wos-arm64-build/actions/runs/4252492458/jobs/7396194685#step:2:46)8, Cache Version: ea8764569ab4d245f2db7a85367253cd303504ee4289[46](https://github.com/khelkun/ffmpeg-wos-arm64-build/actions/runs/4252492458/jobs/7396194685#step:2:47)df7d21a697b0c7812f, Cache Scope: refs/tags/v4.2.1-full, Cache Created: 2023-02-23T12:16:30.7133333Z
##[debug]Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
Error: Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: Linux-build-output-run_4252492458
And using the enableCrossOsArchive: true in the actions/cache/restore@v3 does not fix it.
Activity
aparna-ravindra commentedon Jun 24, 2022
Thank you for the report. I was able to reproduce this. From the first look, it appears that there is a bug while converting the cache paths to relative paths for compression in the toolkit. I will debug the cause and get back.
Contribution are welcome as this will mostly require changes in actions/toolkit and actions/cache.
erwan-joly commentedon Aug 4, 2022
It doesn't seems to be fixed for some reason :/
I've tested with actions/cache@v3.0.1 both the two version with . and env variable and it still cache 22B @pdotl
lvpx commentedon Aug 4, 2022
Hi @erwan-joly , the above version is for actions/cache npm module and not for the actions/cache action. We are yet to merge toolkit changes into the
actions/cache. Once done, you should be able to test and use the same. I'll post an update here once done.lvpx commentedon Aug 5, 2022
@erwan-joly ,please test now with the latest version of actions/cache using
actions/cache@v3.erwan-joly commentedon Aug 5, 2022
@pdotl I confirm it's now fixed 💯
khelkun commentedon Feb 23, 2023
One should also consider this issue if he has troubles with
github.worspacecontext and cache action as I did:My build job relies on
${{ github.workspace }}to output its result and I want to cache this result and restore it in my publish job. Here is how I made this works:Note that restoring a cache in a container image different from the one that saved the cache may fail because the comrpession tool (tar) may be different. For example using
image: alpine:latestcontainer in mypublishjob fails this way:On the other hand, using no container on the my
publishjob fails this way:And using the
enableCrossOsArchive: truein theactions/cache/restore@v3does not fix it.