Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache-Hit output is null #1448

Closed
MarcoJanecki opened this issue Aug 12, 2024 · 3 comments
Closed

Cache-Hit output is null #1448

MarcoJanecki opened this issue Aug 12, 2024 · 3 comments
Assignees

Comments

@MarcoJanecki
Copy link

MarcoJanecki commented Aug 12, 2024

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! :)

@joshmgross
Copy link
Member

This should be fixed by #1404, which will be released in the next version update.

@joshmgross joshmgross self-assigned this Aug 14, 2024
@joshmgross
Copy link
Member

This will be included in 4.1.0 - #1464

@joshmgross
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants