Skip to content

Cross-OS caching: Cache in Ubuntu + OS matrix = no hit in Windows #591

Closed

Description

@eirikb

Hi. This issue is manually copied from actions/runner-images#3424 .
Could be related to #144 .
This comment by @maxim-lobanov is very interesting, and might explain why I'm having problems.


Original issue text

Description
Trying to pass data between jobs using cache.

I'm currently using artifacts, but I don't need these files to be available for download, and it seems artifacts are slower (more upload/download), so I would like to use cache instead.
I use multiple OSes, but Windows does not seem to be able to see caches from Ubuntu.
The other way around is also true, Ubuntu can't see caches from Windows.
MacOS can see both.

Area for Triage:
Scripting and command line

Question, Bug, or Feature?:
Bug

Virtual environments affected

  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11
  • Windows Server 2016 R2
  • Windows Server 2019

Image version
2.278.0

Expected behavior
Cache hit in Windows

Actual behavior
No cache hit in Windows

Repro steps
Cache from Ubuntu, can not be read by Windows:
https://github.com/eirikb/gradlex-test/runs/2623752327?check_suite_focus=true
image

Cache from Windows can not be read by Ubuntu:
https://github.com/eirikb/gradlex-test/runs/2623807942?check_suite_focus=true
image

I could understand if this had something to do with runners in different environments or something, but isn't caches stored elsewhere, and why can MacOS see both?

Activity

  1. j-boivie commented on May 20, 2021

    @j-boivie

    I've run into something like this as well, but in my case a macOS job is not able to read the cache created from a Windows runner.

  2. dhadka commented on May 20, 2021

    @dhadka
    Contributor

    @eirikb @j-boivie Yes, this is due to a bug using zstd and BSD tar on Windows. You can fix this by adding GNU tar to the system path before running the cache step - see #576 (comment) for an example.

    We plan to make GNU tar the default on Windows, but in the meantime I would recommend the workaround above. This fix is being tracked by actions/toolkit#552.

  3. eirikb commented on May 20, 2021

    @eirikb
    Author

    @dhadka Thank you. I've verified the workaround works. I'll close this issue since this is already being tracked.

    For anyone stumbling over this issue, the workaround including OS matrix. looks like this:

        steps:
          - name: "Use GNU tar instead BSD tar"
            if: matrix.os == 'windows-latest'
            shell: cmd
            run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
          - uses: actions/cache@v2
            with:
              path: hello
              key: hello
    
  4. pinned this issue on Aug 22, 2022
  5. unpinned this issue on Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions