Restoring cache on Windows created on Linux silently fails if GNU tar is not on Windows Path
See original GitHub issueI setup a CI pipeline where a linux job downloads files from a remote repository and puts them into a cache. Then jobs on different platforms (linux, macos, windows) are started that reference the cache. All jobs receive a cache hit but on Windows the downloaded cache archive is empty.
It looks like on Windows the filename cache.tgz
is expected but on Linux and MacOS cache.tzst
is used.
These are the logs I get for the jobs using the cache:
Linux:
------
Run actions/cache@v2
with:
path: .extensions
key: extensions-802592892
restore-keys: extensions-
Received 129569068 of 129569068 (100.0%), 136.2 MBs/sec
Cache Size: ~124 MB (129569068 B)
/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/8f4a3549-d2e9-4b85-a044-4c0d37f47d60/cache.tzst -P -C /home/runner/work/vitcode/vitcode
Cache restored successfully
Cache restored from key: extensions-802592892
MacOS:
------
Run actions/cache@v2
with:
path: .extensions
key: extensions-802592892
restore-keys: extensions-
Received 129569068 of 129569068 (100.0%), 45.9 MBs/sec
Cache Size: ~124 MB (129569068 B)
/usr/local/bin/gtar --use-compress-program zstd -d -xf /Users/runner/work/_temp/d133514d-3d07-4e10-8844-14d51d463fff/cache.tzst -P -C /Users/runner/work/vitcode/vitcode --delay-directory-restore
Cache restored successfully
Cache restored from key: extensions-802592892
Windows:
--------
Run actions/cache@v2
with:
path: .extensions
key: extensions-802592892
restore-keys: extensions-
Received 30 of 30 (100.0%), 0.0 MBs/sec
Cache Size: ~0 MB (30 B)
C:\Windows\System32\tar.exe -z -xf D:/a/_temp/7133fe6d-5fa6-462d-a494-8faa9cdd0b31/cache.tgz -P -C D:/a/vitcode/vitcode
Cache restored successfully
Cache restored from key: extensions-802592892
Pseudo pipeline config:
name: Build
jobs:
download-extensions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: .extensions
key: extensions-${{ github.run_id }}
restore-keys: extensions-
- name: "Downloading Extensions"
shell: bash
run: ... # execute commands that download files to ./.extensions
build-on-linux:
runs-on: ubuntu-latest
needs: [ download-extensions ]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: .extensions
key: extensions-${{ github.run_id }}
- name: "Build"
# ... build software
build-on-macos:
runs-on: macos-latest
needs: [ download-extensions ]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: .extensions
key: extensions-${{ github.run_id }}
- name: "Build"
# ... build software
windows-amd64:
runs-on: macos-latest
needs: [ download-extensions ]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: .extensions
key: extensions-${{ github.run_id }}
- name: "Build"
# ... build software
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
actions/cache fails on Windows when GNU tar from MSYS2 is ...
The problem seems to be that the cache paths written to manifest.txt use \\ and not / , which I would think GNU...
Read more >Tar - GNU Project - Free Software Foundation
This fixes tar's behavior to match its documentation, and is a bit safer when extracting untrusted archives over old files (an unsafe practice...
Read more >tar: Exiting with failure status due to previous errors - Super User
I have written a little script that tars and compresses a list of directories + files. The script appears to ...
Read more >tar(1): manual page for tar 1.23 - Linux man page
tar (1) - Linux man page GNU 'tar' saves many files together into a single tape or disk archive, and can restore individual...
Read more >Cygwin FAQ
Cygwin is a distribution of popular GNU and other Open Source tools running on Microsoft Windows. The core part is the Cygwin library...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since this hasn’t been addressed… it needs to stay alive.
Thanks for this. My solution (on self-hosted Windows runner) was to put
C:\Program Files\Git\usr\bin
early in the system path on the Windows machine and restart the runner service.I also had to install zstd.exe in C:\Program Files\Git\usr\bin to get it to work.
@sebthom since you sorted this out, could you please retitle and add to the OP what you learned? A title like “restoring cache fails if GNU tar is not the default tar in $PATH” would help people sort this out.