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

expands re-use dependency layers page #750

Merged
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,35 @@
weight=99
+++

The [lifecycle](https://buildpacks.io/docs/for-buildpack-authors/concepts/lifecycle-phases/) provides a mechanism for buildpacks to explicitly opt into reusing any necessary [dependency layers](https://buildpacks.io/docs/for-buildpack-authors/concepts/layer/) from a previous build. Buildpacks may modify cached build dependencies before reusing them.

Check failure on line 6 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'buildpacks'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'buildpacks'?", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 6, "column": 119}}}, "severity": "ERROR"}

Check failure on line 6 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'Buildpacks'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'Buildpacks'?", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 6, "column": 284}}}, "severity": "ERROR"}

<!--more-->

This page is a stub! The CNB project is applying to [Google Season of Docs](https://developers.google.com/season-of-docs/docs/timeline) to receive support for improving our documentation. Please check back soon.
A buildpack usually reads metadata about layers it created during a previous build to ensure only changed layers are updated. For buildpack authors, this can aid in improving build performance by avoiding re-uploading unchanged layers and restoring any previously-cached dependencies.

Check failure on line 10 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'buildpack'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'buildpack'?", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 10, "column": 3}}}, "severity": "ERROR"}

Check warning on line 10 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('are updated'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('are updated').", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 10, "column": 114}}}, "severity": "INFO"}

Check failure on line 10 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'buildpack'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'buildpack'?", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 10, "column": 131}}}, "severity": "ERROR"}

Check failure on line 10 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.LyHyphens] 'previously-cached' doesn't need a hyphen. Raw Output: {"message": "[Google.LyHyphens] 'previously-cached' doesn't need a hyphen.", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 10, "column": 254}}}, "severity": "ERROR"}

To decide whether layer reuse is appropriate, a buildpack should consider:

Check failure on line 12 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'buildpack'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'buildpack'?", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 12, "column": 49}}}, "severity": "ERROR"}

* Whether files in the `<app>` directory have changed since the layer was created.

Check warning on line 14 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('was created'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('was created').", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 14, "column": 71}}}, "severity": "INFO"}
* Whether the environment has changed since the layer was created.

Check warning on line 15 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('was created'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('was created').", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 15, "column": 55}}}, "severity": "INFO"}
* Whether the buildpack version has changed since the layer was created.

Check failure on line 16 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'buildpack'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'buildpack'?", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 16, "column": 15}}}, "severity": "ERROR"}

Check warning on line 16 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('was created'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('was created').", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 16, "column": 61}}}, "severity": "INFO"}
* Whether new application dependency versions have been made available since the layer was created.

Check warning on line 17 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.WordList] Use 'app' instead of 'application'. Raw Output: {"message": "[Google.WordList] Use 'app' instead of 'application'.", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 17, "column": 15}}}, "severity": "WARNING"}

Check warning on line 17 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('been made'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('been made').", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 17, "column": 52}}}, "severity": "INFO"}

Check warning on line 17 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('was created'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('was created').", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 17, "column": 88}}}, "severity": "INFO"}

At the start of the `build` phase a buildpack MAY find:

Check failure on line 19 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'buildpack'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'buildpack'?", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 19, "column": 37}}}, "severity": "ERROR"}

Check warning on line 19 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Acronyms] Spell out 'MAY', if it's unfamiliar to the audience. Raw Output: {"message": "[Google.Acronyms] Spell out 'MAY', if it's unfamiliar to the audience.", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 19, "column": 47}}}, "severity": "INFO"}

* Partial `<layers>/<layer>.toml` files describing layers from the previous builds. The restored `Layer Content Metadata` SHALL NOT contain `launch`, `build`, or `cache` booleans even if those values were set on a previous build.

Check warning on line 21 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Acronyms] Spell out 'SHALL', if it's unfamiliar to the audience. Raw Output: {"message": "[Google.Acronyms] Spell out 'SHALL', if it's unfamiliar to the audience.", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 21, "column": 123}}}, "severity": "INFO"}

Check warning on line 21 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Acronyms] Spell out 'NOT', if it's unfamiliar to the audience. Raw Output: {"message": "[Google.Acronyms] Spell out 'NOT', if it's unfamiliar to the audience.", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 21, "column": 129}}}, "severity": "INFO"}

Check failure on line 21 in content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'booleans'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'booleans'?", "location": {"path": "content/docs/for-buildpack-authors/how-to/write-buildpacks/re-use-layers.md", "range": {"start": {"line": 21, "column": 171}}}, "severity": "ERROR"}
* `<layers>/<layer>.sbom.<ext>` files that were written previously.
* `<layers>/<layer>/` directories containing layer contents that have been restored from the cache.

A buildpack:

* MAY set `launch = true` under `[types]` in the restored `<layers>/<layer>.toml` file in order to include the layer in the final OCI image.
* MAY modify `metadata` in `<layers>/<layer>.toml`
* MAY modify `metadata` in `<layers>/<layer>.sbom.<ext>`
* **If** the layer contents have been restored to the `<layers>/<layer>/` directory
* MAY set `build = true` under `[types]` in the restored `<layers>/<layer>.toml` to expose the layer to subsequent buildpacks.
* MAY set `cache = true` under `[types]` in the restored `<layers>/<layer>.toml` to persist the layer to subsequent builds.
* MAY modify the contents of `<layers>/<layer>/`.

If the buildpack does not set `launch`, `build`, or `cache` under `[types]` in the restored `<layers>/<layer>.toml` the layer SHALL be ignored.

If you are familiar with this content and would like to make a contribution, please feel free to open a PR :)
>For more information on buildpack layer caching, see the documentation on [create dependency layers](https://buildpacks.io/docs/for-buildpack-authors/how-to/write-buildpacks/create-layer/) and [buildpack layer types](https://buildpacks.io/docs/for-buildpack-authors/concepts/caching-strategies/).
Loading