Cache Save/Restore is not working between GitHub Runner and Container, even with the same absolute path.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.6k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to cache files in a standard runner and then access them in a container, but the files aren't being restored as expected.
I noticed the issue mentioned in #1444 (which would be great to have fixed) and read through the guidance in the cross-os-cache docs. From what I understand, the full absolute path for saving and restoring the cache must be identical across environments. In an attempt to address this, I tried placing the files in /tmp/, but even when the full absolute path matches and I've set enableCrossOsArchive: 'true', it still doesn't work. You can see the failure in this run: https://github.com/sabbott1877/cache-issues/actions/runs/10608423120/job/29402474270.
name: Cache Issue Testing
on:
push:
branches:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
create-cache:
name: Setup Cache
runs-on: ubuntu-latest
steps:
- run: |
echo ~
echo $PWD
# Trying to use /tmp to avoid issues with absolute paths, but still seems to be failing.
- name: Create files
run: |
mkdir -p /tmp/cache-path/
echo "test" > /tmp/cache-path/file.txt
- name: Cache Files
uses: actions/cache/save@v4
with:
path: /tmp/cache-path
key: cache-path-${{ github.run_id }}
enableCrossOsArchive: 'true'
read-cache:
name: Read Cache
needs: create-cache
runs-on: ubuntu-latest
container:
image: rockylinux:9
options: -u root
steps:
- run: |
echo ~
echo $PWD
- name: Get Cached Files
uses: actions/cache/restore@v4
with:
path: /tmp/cache-path
key: cache-path-${{ github.run_id }}
enableCrossOsArchive: 'true'
fail-on-cache-miss: 'true'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the workflow using actions/cache/save@v4 and actions/cache/restore@v4, with /tmp/cache-path on ubuntu-latest and the Rocky Linux 9 container. Compare the runner and container environments and determine whether the cache path is accessible during restore; done means the behavior is explained and the issue is fixed or its limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, github-actions, typescript
- Domain
- ci-cd, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100