Comments (9)
@dovisutu I believe you are on the right track, as we were running into this issue at my work place as well.
This PR added the earlyExit
condition:
however, it wasn't implemented beyond just adding a default of undefined
(which will always evaluate to false
for that if
). I assume what should have been done instead is the default should be based off that setting, and not just set to undefined
.
cc @chkimes @kgrzebien @cwille97 as you were active on that PR.
For now, it seems like this was only merged into the most recent release (v3.3.2
) to address this issue:
So you can downgrade/pin your action/cache
to v3.3.1
and you should be able to get this functionality back.
from cache.
Can confirm, setting the version to v3.3.1
forced the workflow to fail correctly
from cache.
My interpretation of the
fail-on-cache-miss
feature on theactions/cache
andactions/cache/restore
actions is that the workflow should stop and be considered a fail if there is no cache found with the given key.I'm seeing evidence in workflows where using the
actions/cache/restore
action will not fail even if this option is set totrue
.Snippet from the workflow file:
Acceptance-Linux: name: "Acceptance tests (Linux)" needs: [Build-Snapshot-Artifacts] runs-on: ubuntu-20.04 steps: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 #v4.1.0 - name: Bootstrap environment uses: ./.github/actions/bootstrap - name: Download snapshot build uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 with: path: snapshot fail-on-cache-miss: true key: snapshot-build-${{ github.run_id }} - name: Run comparison tests (Linux) run: make compare-linuxEvidence that the workflow continues past the failed cache restore (failing on the subsequent step, which it should have never reached.
from cache.
erg, thanks @Rolexminus1 ? (you might have intended to write something different than echoing my description... or you're a bot, in which case... beep beep, boop )
For what it's worth, I think I found the problem that was causing the cache miss, which I'm also a little confused at:
- name: Upload snapshot artifacts
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2
with:
path: |
snapshot
.task
key: snapshot-build-${{ github.run_id }}
followed by:
- name: Download snapshot build
id: snapshot-cache
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2
with:
path: snapshot
fail-on-cache-miss: true
key: snapshot-build-${{ github.run_id }}
Note the difference in the path
provided (snapshot
vs [snapshot, .task]
logically).
My understanding is that I'd be able to store multiple paths and restore one of those paths, which does not appear to be working. However, in my case, this was a bug and I should have been restoring both paths anyway.
All that being said, it still doesn't address the original problem (fail-on-cache-miss
doesn't fail the workflow) so I have the following workaround for now as a subsequent step:
- name: (cache-miss) Snapshot build missing
if: steps.snapshot-cache.outputs.cache-hit != 'true'
run: echo "unable to download snapshots from previous job" && false
from cache.
I am seeing the same behaviour, using the same path in save and restore in my cache. Also on actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
Doing some investigating:
The thrown error is already being catched here:
Lines 84 to 86 in 704facf
But it will only exit with an error if the calling function catches an error. (earlyExit
seems to always be set to true).
Lines 93 to 100 in 704facf
The try catch of the callee function probably just needs to be removed for this to work. So core.setFailed((error as Error).message)
should be moved to the caller error handler.
from cache.
This has worked in the past for us.
from cache.
Also run into the said issue that fail-on-cache-miss
not failing, although initially I suspected that it was me that was doing things wrong...
I wonder, though, if cache
and restore
use pretty much the same (not exactly) logic on catching [if I could read Typescript correctly], why should cache
work fine on fali-on-cache-miss
? Or is it also failing, yet neglected for its (maybe?) rare usage?
if (earlyExit) { process.exit(1); }
If I understood correctly, shouldn't exiting with return value of 1
already fail a step, then?
from cache.
Related Issues (20)
- - [ ] curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders/<order_id>/capture \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ACCESS-TOKEN"
- Cache miss when restoring within a reusable workflow HOT 3
- * @actions/actions-cache
- BornNk
- Cache miss on Windows despite a successful cache-write HOT 7
- How to do fine-grained caching: bulk APIs?
- Add `--remove-files`to avoid running out of space
- Emit a warning instead of a silent failure when zstd is missing
- Warning: Failed to restore: downloadCache failed: unable to verify the first certificate HOT 5
- Cocoapods example should cache the system cache rather than build products
- Support for leveraging cache across scopes on demand
- Can not access cache from Linux runner on Mac runner
- What is the default `upload-chunk-size`?
- Cache miss for restore-keys: `setup-java-...`
- Cache restored successfully = sf: command not found
- Cache service responded with 503
- Version 3.3.2 fails to save cache on self-hosted windows runner HOT 2
- Missing cache in containerized job when using v3 HOT 2
- `lookup-only` doesn't with `cache-hit`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cache.