actions / actions/toolkit

Cache created on Linux is not restorable on Windows

Open
#2,181 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Hi,
we've noticed some inconsistencies with how cache behaves with setting enableCrossOsArchive to true:

  • cache created on Windows can be restored on Linux
  • cache created on Linux cannot be restored on Windows

I suspect that this might be related to the compression method that's being used as it's also included in the cache file path. Linux uses zstdmt for compression but Windows uses zstd -T0 command.

// actions/toolkit/packages/cache/src/internal/tar.ts // getCompressionProgram() does NOT receive enableCrossOsArchive parameter return ['--use-compress-program', IS_WINDOWS ? '"zstd -T0"' : 'zstdmt']

The testing was done on standard ubuntu-latest and windows-latest GitHub hosted runners.

Are you aware of the issue?
To Reproduce
Steps to reproduce the behavior:

  1. Cache any files on Linux runner with enableCrossOsArchive enabled
  2. Restore cache created on Linux on Windows runner - this step fails

Expected behavior
Cache created on Linux is restorable on Windows and the other way around.

Are you aware of this issue?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read actions/toolkit/packages/cache/src/internal/tar.ts and inspect getCompressionProgram(), especially the platform-specific compression commands. Reproduce the Linux-to-Windows restore failure with enableCrossOsArchive enabled, then verify that caches created on both platforms restore successfully across operating systems.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.