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

Restore cached layer metadata for launch: true & cache: true from cache as a fallback #406

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions buildpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,23 @@ The lifecycle MUST treat a layer with unset `types` as a `launch = false`, `buil
The following table illustrates the behavior depending on the value of each flag.
Note that the lifecycle only restores layers from the cache, never from the previous image.

`build` | `cache` | `launch` | Metadata and SBOM** Restored | Layer Restored
----------|----------|----------|------------------------------|---------------------
true | true | true | Yes - from the app image | Yes* - from the cache
true | true | false | Yes - from the cache | Yes - from the cache
true | false | true | No | No
true | false | false | No | No
false | true | true | Yes - from the app image | Yes* - from the cache
false | true | false | Yes - from the cache | Yes - from the cache
false | false | true | Yes - from the app image | No
false | false | false | No | No

\* The metadata and layer are restored only if the layer SHA recorded in the previous image matches the layer SHA recorded in the cache.
| `build` | `cache` | `launch` | Metadata and SBOM** Restored | Layer Restored |
| ------- | ------- | -------- | ---------------------------- | --------------------- |
| true | true | true | Yes - from the app image*** | Yes* - from the cache |
| true | true | false | Yes - from the cache | Yes - from the cache |
| true | false | true | No | No |
| true | false | false | No | No |
| false | true | true | Yes - from the app image*** | Yes* - from the cache |
| false | true | false | Yes - from the cache | Yes - from the cache |
| false | false | true | Yes - from the app image | No |
| false | false | false | No | No |
pbusko marked this conversation as resolved.
Show resolved Hide resolved

\* If the previous image was found, the metadata and layer are restored only if the layer SHA recorded in the image matches the layer SHA recorded in the cache.
pbusko marked this conversation as resolved.
Show resolved Hide resolved

\** Only SBOM files associated with a layer are restored. Launch-level and build-level SBOM files must be re-created on each build.

\*** If the app image is not found or it is missing cached metadata for a layer, the metadata will be restored from the cache, if found.

pbusko marked this conversation as resolved.
Show resolved Hide resolved
Examples:
* `build = true, cache = true, launch = true`:
A Ruby buildpack provides the Ruby interpreter to a subsequent buildpack and additionally installs Ruby in the app image to support the application. The Ruby is restored from the cache on rebuild, and the Ruby buildpack can use layer metadata to ensure the correct version is present.
Expand Down