-
Notifications
You must be signed in to change notification settings - Fork 8
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
Improve UX for cached layers that have forgotten to implement existing_layer_strategy()
#371
Comments
existing_layer_strategy()
for a layerexisting_layer_strategy()
for a cached layer
existing_layer_strategy()
for a cached layerexisting_layer_strategy()
FWIW, I got confused by this recently as well and had to dive quite deep to understand why my layer wasn't doing what I expected it to do (caching). I think we should talk again about the This does not mean we shouldn't have a |
The problem with a default of As such, it feels like "why is my thing not changing when I've changed my code" is going to be equally as hard to debug, and will replace the current confusion. |
For me, the difference here is that you explicitly write |
FWIW I support addressing the confusion around |
To be clear, I mean a scenario where a I also can't think of a single case where it would be correct for a Therefore, having a default As such, I think the default We should probably also decide how far we want to support the "this buildpack didn't write this layer" / "a layer has changed from |
The current default for `existing_layer_strategy` will recreate a layer on every subsequent build. Effectively that means that if `cached: true` but `existing_layer_strategy` is not set, then the layer is not cached. This is documented in #371. This PR introduces a CachedLayer trait that implements `Layer` such that the user MUST define `existing_layer_strategy`. Sidenote: Is it possible to assert some code doesn't compile? It would be good to encode this desire into the framework so someone doesn't accidentally provide a default implementation in the future, for example. Fixes #371
Something that came up in our team huddle today was that if a Layer has a
types()
that includescache: true
, then if the Layer doesn't implementexisting_layer_strategy()
the layer will silently not be cached, which can cause confusion.To improve this, we could:
CachedLayer
), which can enforce thatexisting_layer_strategy()
is implementedLayer::existing_layer_strategy
implementation to fail iftypes()
returnscache: true
cc @jonnymacs
The text was updated successfully, but these errors were encountered: