cache
cache copied to clipboard
Version 3.3.2 fails to save cache on self-hosted windows runner
I am trying to cache data with version 3.3.2, but it fails to save the data to the cache with an error. The runner is a self-hosted windows runner for a GitHub Enterprise Server 3.10.3 instant.
This is the step being used to cache the data.
- name: Cache Data
id: cache-data
uses: actions/[email protected]
with:
path: dynamic
key: myfile-dynamic6
This is the Post Cache Data error message:
Post job cleanup.
"C:\Program Files\Git\usr\bin\tar.exe" --posix -cf cache.tgz --exclude cache.tgz -P -C C:/actions-runner/_work/MyCode/MyCode --files-from manifest.txt --force-local -z
/bin/sh: line 1: gzip: command not found
/usr/bin/tar: Child returned status 127
/usr/bin/tar: Error is not recoverable: exiting now
Warning: Failed to save: "C:\Program failed with error: The process 'C:\Program Files\Git\usr\bin\tar.exe' failed with exit code 2
If I use version v3.2.2 instead of v3.3.2 the cache file looks like it's created. At least it shows up in the Actions | Caches menu, and I see it has a byte size that changes as the content changes. The problem with the v3.2.2 version is that it fails to be restored.
This is the step that successful saves.
- name: Cache Data
id: cache-data
uses: actions/[email protected]
with:
path: dynamic
key: myfile-dynamic6
This is the step to restore.
- name: Restore cached
uses: actions/cache/[email protected]
with:
path: dynamic
key: myfile-dynamic6
This is the message saying failed to restore because it couldn't find the input key.
Run actions/cache/[email protected]
with:
path: dynamic
key: myfile-dynamic6
Warning: Failed to restore:
Cache not found for input keys: myfile-dynamic6
This is a screenshot showing that the cache exits with the expected key.
Is there anything more I can do to debug this issue as to why it fails to find the expected key in version 3.2.2? Is there a bug in 3.3.2 for windows runners that use the cache?
Thanks, Justin
Providing an update here.
I was able to resolve the issue by installing gzip on the Windows runner. Even though git was installed on the runner with a gzip tool, it seems the gzip wasn't able to be found. Interesting though it seems that the tar command under git was being used for this action.
The Windows runner we use had the chocolatey software tool installed on it, so I just used chocolatey to install gzip with the following command.
choco install gzip
The Windows runner also didn't have zstd tool on it, but I think it can work without it. In the end, I ended up installing that tool also using chocolatey.
choco install zstandard
The zstd provides some additional saving on space as it compresses the file more.
I wish the action documentation provided these details on setup for windows self hosted runners so I wouldn't have to figure this all out through trial and error.
Thanks for the detailed write up. We hit the same issue with gzip
not being available.