-
Notifications
You must be signed in to change notification settings - Fork 70
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
Opt-in layer caching #151
Opt-in layer caching #151
Conversation
Signed-off-by: Emily Casey <[email protected]>
Signed-off-by: Emily Casey <[email protected]>
buildpack.md
Outdated
|
||
- Whether files in the `<app>` directory have changed since the layer was created. | ||
- Whether the environment has changed since the layer was created. | ||
- Whether the buildpack version has changed since the layer was created. | ||
- Whether new application dependency versions have been made available since the layer was created. | ||
|
||
At the start of the build phase a buildpack MAY find: | ||
- Partial `<layers>/<layer>.toml` files describing layers from the previous builds. The restored Layer Content Metadata SHALL NOT contain `launch`, `build`, or `cache` booleans. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this might be surprising, maybe we should call-out that it "SHALL NOT" even if those values were set on a previous build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Emily Casey <[email protected]> Co-authored-by: Joe Kutner <[email protected]>
…previously Signed-off-by: Emily Casey <[email protected]>
dc95245
to
6fcc092
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, but see comment on .ignore
buildpack.md
Outdated
- MUST NOT store the layer or the Layer Content Metadata in the cache. | ||
At the end of each individual buildpack's build phase: | ||
- The lifecycle: | ||
- MUST rename `<layers>/<layer>/` to `<layers>/<layer>.ignore/` for all layers where `launch = false`, `build = false`, and `cache = false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to state how the lifecycle treats layers with a .ignore
suffix? An interpretation of this could suggest that <layer>.ignore.toml
controls the behavior of the ignored layer, when really we're just trying to get the layer out of the way / change its path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, given we only rename to <layer>.ignore
when all of launch
, build
, and cache
are false
, technically the lifecycle doesn't need to treat a layer with an .ignore
suffix any differently than a regular layer. The lifecycle already does nothing with this type of layer.
However, I can add a sentence to clear up the intent behind the rename here.
Signed-off-by: Emily Casey <[email protected]>
There was one oversight in the original design of this RFC: Original Assumption: We assumed that
Problem: However, b/c Proposed Resolution: Therefore, after some discussion in slack we have decided to hold this change and merge it with another change that moves these bools into a
Since we are moving the keys, this would also be an opportunity to rename them if we wish to before Result To avoid blocking buildpack API 0.5 on the proposed changes I am moving this change to the buildpack API 0.6 milestone and converting this PR to a draft. TODO After buildpack API 0.5 is release and the |
|
||
Layers marked `launch = false`, `build = false`, and `cache = false` behave like temporary directories, available only to the authoring buildpack, that exist for the duration of a single build. | ||
The lifecycle restores all layers from previous builds as ignored layers. Buildpacks MUST set `launch`, `build`, and/or `cache` in `<layers>/<layer>.toml` to use a restored layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth clarifying that "as ignored layers" means the types flags are set to false in the toml file, otherwise this could be interpreted to mean that the directory is also named with .ignore.
- The lifecycle: | ||
- MUST either restore the entire `<layers>/<layer>.toml` file and corresponding `<layers>/<layer>/` directory from any previous build to the same paths or | ||
- MUST restore neither the `<layers>/<layer>.toml` file nor corresponding `<layers>/<layer>/` directory. | ||
- The lifecycle MUST do both or neither of the following: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth calling out that "both" is for cache = true
and "neither" is for cache = false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there is that edge case where cache = false
and launch = true
. I don't know if that's too much detail...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's important that the spec will be clear enough and explain all of the cases. I'll try to make it clearer.
7. Write a partial Bill-of-Material to `<layers>/launch.toml` describing any provided application dependencies. | ||
8. Write a partial Bill-of-Material to `<layers>/build.toml` describing any provided build dependencies. | ||
1. Provide the application with dependencies for launch in `<layers>/<layer>`. | ||
1. Reuse application dependencies from a previous image by appending by `launch = true` to `<layers>/<layer>.toml`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Reuse application dependencies from a previous image by appending by `launch = true` to `<layers>/<layer>.toml`. | |
1. Reuse application dependencies from a previous image by appending `launch = true` to `<layers>/<layer>.toml`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also requires that the buildpack does NOT create a <layers>/<layer>
of its own... IDK if that is implied or would be worth spelling out. Personally I found myself re-reading this a couple of times...
It might make sense to include #185 in this PR, so that it could all go in together. I had a question about how #185 should be reflected, probably it affects this PR as well: #185 (comment) |
Closing in favor of #209 |
Fixes #132
Note:
Parts of this change were a bit awkward b/c the buildpack spec is missing the
restore
phase. However, I think adding a restore phase and/or reorganizing the buildpack spec is beyond the scope of this issue.