Skip to content

Actions/cache breaks symlink on Windows runners #1010

@FabienPean

Description

@FabienPean

Summary

Github actions/cache@v3 does not restore symlink properly on Windows by default. See for example restoring Intel MKL below:

11/28/2022  10:54 PM    <DIR>          .
11/28/2022  11:20 PM    <DIR>          ..
11/28/2022  10:54 PM    <DIR>          2022.0.3
11/28/2022  11:20 PM    <SYMLINKD>     latest [\??\C:\Program Files (x86)\Intel\oneAPI\mkl\2022.0.3]

Context

This occurred during an action to cache Intel MKL. The minimal example is reproduced in the following repository with the following script

Digging previous issues, I could find one possible solution by adding the following step:

    steps:
    - name: Use GNU Tar from Msys
      if: ${{ runner.os == 'Windows' }}
      run: |
        echo "C:\msys64\usr\bin" >> $env:GITHUB_PATH

However this is hardly convenient and was time consuming to first identify the problem and then to find it.

Differences

Logs are there: https://github.com/FabienPean/test-actions-cache/actions/runs/3586177236/jobs/6035270661

Caching difference

C:\Windows\System32\tar.exe --posix -z -cf cache.tgz --exclude cache.tgz -P -C D:/a/test-actions-cache/test-actions-cache --files-from manifest.txt

vs

C:\msys64\usr\bin\tar.exe --posix --use-compress-program "zstd -T0" -cf cache.tzst --exclude cache.tzst -P -C D:/a/test-actions-cache/test-actions-cache --files-from manifest.txt --force-local

Restoring difference

C:\Windows\System32\tar.exe -z -xf D:/a/_temp/79e339ad-c303-4c67-aa2c-d0533f9a6395/cache.tgz -P -C D:/a/test-actions-cache/test-actions-cache

vs

C:\msys64\usr\bin\tar.exe --use-compress-program "zstd -d" -xf D:/a/_temp/e365a544-fe05-44e5-86cd-035de603e3e4/cache.tzst -P -C D:/a/test-actions-cache/test-actions-cache --force-local

Desired solution

By order of preference:

  1. Work by default
  2. Input to the action
  3. Add documentation

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions