Open wmertens opened 1 month ago
I am checking if a cache exists in one job and if it's missing, creating it in another job in the same workflow.
This works once, but subsequent runs don't see that particular cache and they can't write to the new cache.
Interestingly, other caches in that same workflow are fine.
Here's where I check if the cache exists:
- name: 'cache: qwik' id: cache-qwik uses: actions/cache/restore@v4 with: lookup-only: true path: packages/qwik/dist key: ${{ hashfiles('pnpm-lock.yaml', 'packages/qwik/**/*') }}
and then later I write to it:
- name: Save cache uses: actions/cache/save@v4 with: path: packages/qwik/dist/ key: ${{ needs.changes.outputs.hash-qwik }}
First it doesn't find the cache:
Run actions/cache/restore@v4 with: lookup-only: true path: packages/qwik/dist key: c660bbff0b137960eb51b0c1eb[2](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650812414#step:6:2)f0afa6504525dfafc7ea[3](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650812414#step:6:3)31339e48dad5a593 enableCrossOsArchive: false fail-on-cache-miss: false env: CARGO_INCREMENTAL: 0 Cache not found for input keys: c660bbff0b137960eb51b0c1eb2f0afa650[4](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650812414#step:6:4)525dfafc7ea331339e48dad5a[5](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650812414#step:6:5)93
The cache does exist for that branch, it was written in an earlier, cancelled workflow:
Run actions/cache/save@v4 with: path: packages/qwik/dist/ key: c660bbff0b137960eb51b0c1eb[2](https://github.com/QwikDev/qwik/actions/runs/8973344736/job/24643291601#step:8:2)f0afa6504525dfafc7ea[3](https://github.com/QwikDev/qwik/actions/runs/8973344736/job/24643291601#step:8:3)31339e48dad5a593 enableCrossOsArchive: false env: CARGO_INCREMENTAL: 0 PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX /usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/qwik/qwik --files-from manifest.txt --use-compress-program zstdmt Cache Size: ~5 MB (5517627 B) Cache saved successfully Cache saved with key: c660bbff0b137960eb51b0c1eb2f0afa650[4](https://github.com/QwikDev/qwik/actions/runs/8973344736/job/24643291601#step:8:4)525dfafc7ea331339e48dad5a593
and so predictably the save fails:
Run actions/cache/save@v4 with: path: packages/qwik/dist/ key: c660bbff0b137960eb51b0c1eb[2](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650820938#step:8:2)f0afa6504525dfafc7ea[3](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650820938#step:8:3)31339e48dad5a593 enableCrossOsArchive: false env: CARGO_INCREMENTAL: 0 PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX /usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/qwik/qwik --files-from manifest.txt --use-compress-program zstdmt Failed to save: Unable to reserve cache with key c660bbff0b137960eb51b0c1eb2f0afa650[4](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650820938#step:8:4)525dfafc7ea331339e48dad5a593, another job may be creating this cache. More details: Cache already exists. Scope: refs/heads/build/v2-temp-deleteme, Key: c660bbff0b137960eb[5](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650820938#step:8:5)1b0c1eb2f0afa6504525dfafc7ea331339e48dad5a593, Version: 97b2de491[6](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650820938#step:8:6)3b9c6e6eb52d3c39[7](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650820938#step:8:7)fb9d4ee5e1c5b0138854c7a22550bd66bb[8](https://github.com/QwikDev/qwik/actions/runs/8975670439/job/24650820938#step:8:8)50 Warning: Cache save failed.
What could be the reason for this?
Similar issue: https://github.com/actions/cache/issues/1361
Closing this in favor of #1361 which is the same issue
I am checking if a cache exists in one job and if it's missing, creating it in another job in the same workflow.
This works once, but subsequent runs don't see that particular cache and they can't write to the new cache.
Interestingly, other caches in that same workflow are fine.
Here's where I check if the cache exists:
and then later I write to it:
First it doesn't find the cache:
The cache does exist for that branch, it was written in an earlier, cancelled workflow:
and so predictably the save fails:
What could be the reason for this?