Skip to content

Actions/cache breaks symlink on Windows runners #1010

Closed

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

Activity

  1. Phantsure commented on Dec 2, 2022

    @Phantsure
    Contributor

    @FabienPean Thank you for investigating the issue. We are currently working to publish the solution and making GNU as default on windows. We know current solution of bsd tar has this issue. You may want to follow this issue for details on our solution: #984

    Hope it is okay to close this issue if you find our solution acceptable

  2. FabienPean commented on Dec 2, 2022

    @FabienPean
    Author

    Ok great, feel free to close, though if the fix is not coming so soon (more than a month ?), then it would be nice to have the problem reported here (https://github.com/actions/cache/blob/main/tips-and-workarounds.md), especially since it is containing the fix for a different problem, but not the keywords for this issue.

  3. Phantsure commented on Dec 7, 2022

    @Phantsure
    Contributor

    We have released fix in beta at actions/[email protected]. Would you like to test it?

  4. FabienPean commented on Dec 7, 2022

    @FabienPean
    Author

    Thanks ! actions/[email protected] does solve this issue (tested here https://github.com/FabienPean/test-actions-cache/actions/runs/3642495201/jobs/6149915072) I am closing this issue assuming the beta will soon be rolled out

  5. added a commit that references this issue on Nov 6, 2023
  6. added a commit that references this issue on Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions