Hey guys! :)
We are currently trying to implement caching for Docker layers using the v4 Action.
We encountered the problem, that the outputs are always empty (i.e. outputs.cache-hit == null). We already investigated into almost every edge case and became stuck.
If I interpret the documentation correctly, such a missing output should never occur (should always be either true or false?)
Those are the respective steps from our Github Workflow:
- name: Docker layers caching
id: cache-docker
uses: actions/cache@v4
continue-on-error: true
with:
fail-on-cache-miss: true
path: /tmp/docker-cache
key: ${{ runner.os }}-docker-${{ hashFiles('docker/docker-compose.yaml') }}
- name: Check cache hit
run: |
echo "Cache hit: ${{ toJson(steps.cache-docker.outputs.cache-hit) }}"
echo "Output hit: ${{ toJson(steps.cache-docker.outputs) }}"
echo "Output hit: ${{ toJson(steps.cache-docker.outcome) }}"
echo "Cache hit is true: ${{ steps.cache-docker.outputs.cache-hit == 'true'}}"
echo "Cache hit is false: ${{ steps.cache-docker.outputs.cache-hit == 'false'}}"
Output step "Docker layers caching":
Run actions/cache@v4
with:
fail-on-cache-miss: true
path: /tmp/docker-cache
key: Linux-docker-768b87720c2e53c457935d1efe1ba2781796490829eaecdc0667cbfa08bcd50e
enableCrossOsArchive: false
lookup-only: false
save-always: false
env:
pythonLocation: /opt/hostedtoolcache/Python/3.11.9/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.9/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.9/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.9/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.9/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.9/x64/lib
Error: Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: Linux-docker-768b87720c2e53c457935d1efe1ba2781796490829eaecdc0667cbfa08bcd50e
Output step "Check cache hit":
Run echo "Cache hit: null"
Cache hit: null
Output hit: {}
Output hit: failure
Cache hit is true: false
Cache hit is false: false
Are we essentially doing something wrong?
Any help is appreciated! Thanks in advance! :)