From d38828abcddcb8f5d967bbe0de52012f878b6ea0 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 1 Dec 2022 09:58:28 -0500 Subject: [PATCH 01/46] Removed stack and mixin from terminology, updated stack section Signed-off-by: Natalie Arellano --- platform.md | 102 ++++++++++++++++++---------------------------------- 1 file changed, 35 insertions(+), 67 deletions(-) diff --git a/platform.md b/platform.md index 223a6e9..91f2d55 100644 --- a/platform.md +++ b/platform.md @@ -104,16 +104,10 @@ Platform API versions: #### CNB Terminology A **buildpack** refers to software compliant with the [Buildpack Interface Specification](buildpack.md). -A **stack** is a contract, implemented by a **build image** and **run image**, that guarantees properties of the **build environment** and **app image**. - -A **stack ID** uniquely identifies a particular **stack**. - A **build image** is an OCI image that provides the base of the **build environment**. A **run image** is an OCI image that provides the base from which **app images** are built. -A **mixin** is a named set of additions to a stack that can be used to make additive changes to the contract. - The **build environment** refers to the containerized environment in which the lifecycle executes buildpacks. An **app image** refers to an OCI image generated by the lifecycle by extending the **run image** with any or all of the following: **app layers**, **launch layers**, **launcher layers**, image configuration. @@ -146,94 +140,68 @@ The following is a non-exhaustive list of terms defined in the [OCI Distribution * **registry** - https://github.com/opencontainers/distribution-spec/blob/main/spec.md#definitions -## Stacks +### Build Image -A typical stack might specify: +A typical build image might specify: * The OS distro in the build environment. * OS packages installed in the build environment. * Trusted CA certificates in the build environment. -* The OS distro or distroless OS in the launch environment. -* OS packages installed in the launch environment. -* Trusted CA certificates in the launch environment. -* The default user and the build and launch environments. - -Stack authors SHOULD define the contract such that any stack images CVEs can be addressed with security patches without violating the [compatibility guarantees](#compatibility-guarantees). - -### Stack ID - -Stack authors MUST choose a globally unique ID, for example: "io.buildpacks.mystack". - -The stack ID: -- MUST NOT be identical to any other stack ID when using a case-insensitive comparison. -- MUST only contain numbers, letters, and the characters `.`, `/`, and `-`. -- SHOULD use reverse domain name notation to avoid name collisions. - -### Build Image +* The default user in the build environment. The platform MUST ensure that: - The image config's `User` field is set to a non-root user with a writable home directory. -- The image config's `Env` field has the environment variable `CNB_STACK_ID` set to the stack ID. - The image config's `Env` field has the environment variable `CNB_USER_ID` set to the user [†](README.md#operating-system-conventions)UID/[‡](README.md#operating-system-conventions)SID of the user specified in the `User` field. - The image config's `Env` field has the environment variable `CNB_GROUP_ID` set to the primary group [†](README.md#operating-system-conventions)GID/[‡](README.md#operating-system-conventions)SID of the user specified in the `User` field. - The image config's `Env` field has the environment variable `PATH` set to a valid set of paths or explicitly set to empty (`PATH=`). -- The image config's `Label` field has the label `io.buildpacks.stack.id` set to the stack ID. -- The image config's `Label` field has the label `io.buildpacks.stack.mixins` set to a JSON array containing mixin names for each mixin applied to the image. +- The image config's `os` and `architecture` fields are set to valid identifiers as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). The platform SHOULD ensure that: -- The image config's `Label` field has the label `io.buildpacks.stack.maintainer` set to the name of the stack maintainer. -- The image config's `Label` field has the label `io.buildpacks.stack.homepage` set to the homepage of the stack. -- The image config's `Label` field has the label `io.buildpacks.stack.distro.name` set to the name of the stack's OS distro. -- The image config's `Label` field has the label `io.buildpacks.stack.distro.version` set to the version of the stack's OS distro. -- The image config's `Label` field has the label `io.buildpacks.stack.released` set to the release date of the stack. -- The image config's `Label` field has the label `io.buildpacks.stack.description` set to the description of the stack. -- The image config's `Label` field has the label `io.buildpacks.stack.metadata` set to additional metadata related to the stack. +- The image config's `variant` field is set to a valid identifier as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). +- The image config's `Label` field has the label `io.buildpacks.distribution.name` set to the OS distribution and the label `io.buildpacks.distribution.version` set to the OS distribution version. + - For Linux-based images, each field should be the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`), as the `os.version` field in an image config may contain combined distribution and version information. + - For Windows-based images, `distribution` should be empty, and `version` should be the value of `os.version` in the image config (e.g., `10.0.14393.1066`). +- The image config's `Label` field has the label `io.buildpacks.base.maintainer` set to the name of the image maintainer. +- The image config's `Label` field has the label `io.buildpacks.base.homepage` set to the homepage of the image. +- The image config's `Label` field has the label `io.buildpacks.base.released` set to the release date of the image. +- The image config's `Label` field has the label `io.buildpacks.base.description` set to the description of the image. +- The image config's `Label` field has the label `io.buildpacks.base.metadata` set to additional metadata related to the image. ### Run Image +A typical run image might specify: +* The OS distro or distroless OS in the launch environment. +* OS packages installed in the launch environment. +* Trusted CA certificates in the launch environment. +* The default user in the run environment. + +Run image authors SHOULD define the contract such that any CVEs can be addressed with security patches without violating the [compatibility guarantees](#compatibility-guarantees). + The platform MUST ensure that: -- The image config's `Label` field has the label `io.buildpacks.stack.id` set to the stack ID. -- The image config's `Label` field has the label `io.buildpacks.stack.mixins` set to a JSON array containing mixin names for each mixin applied to the image. - The image config's `Env` field has the environment variable `PATH` set to a valid set of paths or explicitly set to empty (`PATH=`). +- The image config's `os` and `architecture` fields are set to valid identifiers as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). The platform SHOULD ensure that: - The image config's `User` field is set to a user with a **DIFFERENT** user [†](README.md#operating-system-conventions)UID/[‡](README.md#operating-system-conventions)SID as the build image. -- The image config's `Label` field has the label `io.buildpacks.stack.maintainer` set to the name of the stack maintainer. -- The image config's `Label` field has the label `io.buildpacks.stack.homepage` set to the homepage of the stack. -- The image config's `Label` field has the label `io.buildpacks.stack.distro.name` set to the name of the stack's OS distro. -- The image config's `Label` field has the label `io.buildpacks.stack.distro.version` set to the version of the stack's OS distro. -- The image config's `Label` field has the label `io.buildpacks.stack.released` set to the release date of the stack. -- The image config's `Label` field has the label `io.buildpacks.stack.description` set to the description of the stack. -- The image config's `Label` field has the label `io.buildpacks.stack.metadata` set to additional metadata related to the stack. - -### Mixins - -A mixin name MUST only be defined by the author of its corresponding stack. -A mixin name MUST always be used to specify the same set of changes. -A mixin name MUST only contain a `:` character as part of an optional stage specifier. - -A mixin prefixed with the `build:` stage specifier only affects the build image and does not need to be specified on the run image. -A mixin prefixed with the `run:` stage specifier only affects the run image and does not need to be specified on the build image. -A mixin WITHOUT a `build:` or `run:` prefix affects both the build and the run images. - -A platform MAY support any number of mixins for a given stack in order to support application code or buildpacks that require those mixins. - -Changes introduced by mixins SHOULD be restricted to the addition of operating system software packages that are regularly patched with strictly backwards-compatible security fixes. -However, mixins MAY consist of any changes that follow the [Compatibility Guarantees](#compatibility-guarantees). +- The image config's `Label` field has the label `io.buildpacks.id` set to the target ID (e.g., "minimal") of the image. +- The image config's `variant` field is set to a valid identifier as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). +- The image config's `Label` field has the label `io.buildpacks.distribution.name` set to the OS distribution and the label `io.buildpacks.distribution.version` set to the OS distribution version. + - For Linux-based images, each field should be the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`), as the `os.version` field in an image config may contain combined distribution and version information. + - For Windows-based images, distribution should be empty. Version should be the value of `os.version` in the image config (e.g., `10.0.14393.1066`). +- The image config's `Label` field has the label `io.buildpacks.base.maintainer` set to the name of the image maintainer. +- The image config's `Label` field has the label `io.buildpacks.base.homepage` set to the homepage of the image. +- The image config's `Label` field has the label `io.buildpacks.base.released` set to the release date of the image. +- The image config's `Label` field has the label `io.buildpacks.base.description` set to the description of the image. +- The image config's `Label` field has the label `io.buildpacks.base.metadata` set to additional metadata related to the image. ### Compatibility Guarantees -Stack image authors SHOULD ensure that build image versions maintain [ABI-compatibility](https://en.wikipedia.org/wiki/Application_binary_interface) with previous versions, although violating this requirement will not change the behavior of previously built images containing app and launch layers. - -Stack image authors MUST ensure that new run image versions maintain [ABI-compatibility](https://en.wikipedia.org/wiki/Application_binary_interface) with previous versions. -Stack image authors MUST ensure that app and launch layers do not change behavior when the run image layers are upgraded to newer versions, unless those behavior changes are intended to fix security vulnerabilities. - -Mixin authors MUST ensure that mixins do not affect the [ABI-compatibility](https://en.wikipedia.org/wiki/Application_binary_interface) of any object code compiled to run on the base stack images without mixins. - -During build, platforms MUST use the same set of mixins for the run image as were used in the build image (excluding mixins that have a stage specifier). +- Base image authors SHOULD ensure that build image versions maintain [ABI-compatibility](https://en.wikipedia.org/wiki/Application_binary_interface) with previous versions, although violating this requirement will not change the behavior of previously built images containing app and launch layers. +- Base image authors MUST ensure that new run image versions maintain [ABI-compatibility](https://en.wikipedia.org/wiki/Application_binary_interface) with previous versions. +- Base image authors MUST ensure that app and launch layers do not change behavior when the run image layers are upgraded to newer versions, unless those behavior changes are intended to fix security vulnerabilities. ## Lifecycle Interface From a2d3554db403c36249ae3b9ac216b7be85629178 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Dec 2022 16:09:42 -0500 Subject: [PATCH 02/46] Update analyzer Signed-off-by: Natalie Arellano --- platform.md | 100 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 39 deletions(-) diff --git a/platform.md b/platform.md index 91f2d55..27391ac 100644 --- a/platform.md +++ b/platform.md @@ -154,14 +154,9 @@ The platform MUST ensure that: - The image config's `Env` field has the environment variable `CNB_USER_ID` set to the user [†](README.md#operating-system-conventions)UID/[‡](README.md#operating-system-conventions)SID of the user specified in the `User` field. - The image config's `Env` field has the environment variable `CNB_GROUP_ID` set to the primary group [†](README.md#operating-system-conventions)GID/[‡](README.md#operating-system-conventions)SID of the user specified in the `User` field. - The image config's `Env` field has the environment variable `PATH` set to a valid set of paths or explicitly set to empty (`PATH=`). -- The image config's `os` and `architecture` fields are set to valid identifiers as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). The platform SHOULD ensure that: -- The image config's `variant` field is set to a valid identifier as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). -- The image config's `Label` field has the label `io.buildpacks.distribution.name` set to the OS distribution and the label `io.buildpacks.distribution.version` set to the OS distribution version. - - For Linux-based images, each field should be the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`), as the `os.version` field in an image config may contain combined distribution and version information. - - For Windows-based images, `distribution` should be empty, and `version` should be the value of `os.version` in the image config (e.g., `10.0.14393.1066`). - The image config's `Label` field has the label `io.buildpacks.base.maintainer` set to the name of the image maintainer. - The image config's `Label` field has the label `io.buildpacks.base.homepage` set to the homepage of the image. - The image config's `Label` field has the label `io.buildpacks.base.released` set to the release date of the image. @@ -181,22 +176,31 @@ Run image authors SHOULD define the contract such that any CVEs can be addressed The platform MUST ensure that: - The image config's `Env` field has the environment variable `PATH` set to a valid set of paths or explicitly set to empty (`PATH=`). -- The image config's `os` and `architecture` fields are set to valid identifiers as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). The platform SHOULD ensure that: - The image config's `User` field is set to a user with a **DIFFERENT** user [†](README.md#operating-system-conventions)UID/[‡](README.md#operating-system-conventions)SID as the build image. - The image config's `Label` field has the label `io.buildpacks.id` set to the target ID (e.g., "minimal") of the image. -- The image config's `variant` field is set to a valid identifier as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). -- The image config's `Label` field has the label `io.buildpacks.distribution.name` set to the OS distribution and the label `io.buildpacks.distribution.version` set to the OS distribution version. - - For Linux-based images, each field should be the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`), as the `os.version` field in an image config may contain combined distribution and version information. - - For Windows-based images, distribution should be empty. Version should be the value of `os.version` in the image config (e.g., `10.0.14393.1066`). - The image config's `Label` field has the label `io.buildpacks.base.maintainer` set to the name of the image maintainer. - The image config's `Label` field has the label `io.buildpacks.base.homepage` set to the homepage of the image. - The image config's `Label` field has the label `io.buildpacks.base.released` set to the release date of the image. - The image config's `Label` field has the label `io.buildpacks.base.description` set to the description of the image. - The image config's `Label` field has the label `io.buildpacks.base.metadata` set to additional metadata related to the image. +#### Platform Data + +For both build images and run images, the platform MUST ensure that: + +- The image config's `os` and `architecture` fields are set to valid identifiers as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). +- The build image config and the run image config both specify the same `os`, `architecture`, `variant` (if specified), `io.buildpacks.distribution.name` (if specified), and `io.buildpacks.distribution.version` (if specified). + +The platform SHOULD ensure that: + +- The image config's `variant` field is set to a valid identifier as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). +- The image config's `Label` field has the label `io.buildpacks.distribution.name` set to the OS distribution and the label `io.buildpacks.distribution.version` set to the OS distribution version. + - For Linux-based images, each field should be the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`), as the `os.version` field in an image config may contain combined distribution and version information. + - For Windows-based images, distribution should be empty. Version should be the value of `os.version` in the image config (e.g., `10.0.14393.1066`). + ### Compatibility Guarantees - Base image authors SHOULD ensure that build image versions maintain [ABI-compatibility](https://en.wikipedia.org/wiki/Application_binary_interface) with previous versions, although violating this requirement will not change the behavior of previously built images containing app and launch layers. @@ -237,7 +241,7 @@ or by executing `/cnb/lifecycle/creator`. > The meaning of any particular instance of the word **build** must be assessed in context #### Rebase -When an updated run image with the same stack ID is available, an updated app image SHOULD be generated from the existing app image config by replacing the run image layers in the existing app image with the layers from the new run image. +When an updated run image is available, an updated app image SHOULD be generated from the existing app image config by replacing the run image layers in the existing app image with the layers from the new run image. This is referred to as rebasing the app, launch, and launcher layers onto the new run image layers. When layers are rebased, any app image metadata referencing to the original run image MUST be updated to reference to the new run image. This entire operation is referred to as rebasing the app image. @@ -426,7 +430,7 @@ Usage: | `` | `CNB_LOG_LEVEL` | `info` | Log Level | | `` | `CNB_USER_ID` | | UID of the build image `User` | | `` | `CNB_SKIP_LAYERS` | `false` | Do not perform [layer restoration](#layer-restoration) | -|``| | | Kaniko directory (must be `/kaniko`) | +| `` | | | Kaniko directory (must be `/kaniko`) | ##### Outputs | Output | Description | @@ -745,6 +749,7 @@ Usage: ``` /cnb/lifecycle/rebaser \ [-daemon] \ # sets + [-force] \ [-gid ] \ [-log-level ] \ [-report ] \ @@ -754,20 +759,27 @@ Usage: ``` ##### Inputs -| Input | Environment Variable | Default Value | Description -|---------------------|-----------------------|------------------------|--------------------------------------- -| `` | `CNB_USE_DAEMON` | `false` | Export image to docker daemon -| `` | `CNB_GROUP_ID` | | Primary GID of the build image `User` -| `` | | | App image to rebase -| `` | `CNB_LOG_LEVEL` | `info` | Log Level -| `` | `CNB_REPORT_PATH` | `/report.toml` | Path to report (see [`report.toml`](#reporttoml-toml) -| `` | `CNB_RUN_IMAGE` | derived from `` | Run image reference -| `` | `CNB_USER_ID` | | UID of the build image `User` +| Input | Environment Variable | Default Value | Description | +|---------------|----------------------|------------------------|----------------------------------------------------------| +| `` | `CNB_USE_DAEMON` | `false` | Export image to docker daemon | +| `` | `CNB_FORCE_REBASE` | `false` | Allow mismatched metadata between new and old run images | +| `` | `CNB_GROUP_ID` | | Primary GID of the build image `User` | +| `` | | | App image to rebase | +| `` | `CNB_LOG_LEVEL` | `info` | Log Level | +| `` | `CNB_REPORT_PATH` | `/report.toml` | Path to report (see [`report.toml`](#reporttoml-toml) | +| `` | `CNB_RUN_IMAGE` | derived from `` | Run image reference | +| `` | `CNB_USER_ID` | | UID of the build image `User` | - At least one `` must be provided - Each `` MUST be a valid tag reference -- **If** `` is `false` and more than one `` is provided they MUST refer to the same registry -- **If** `` is not provided by the platform the value will be [resolved](#run-image-resolution) from the contents of the `stack` key in the `io.buildpacks.lifecycle.metdata` label on ``. +- **If** `` is `false` and more than one `` is provided, the images MUST refer to the same registry +- **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `stack` key in the `io.buildpacks.lifecycle.metdata` label on `` +- **If** `` is true the following values in the output `` config MUST be derived from the new ``, or else they MUST match the old run image if `` is false: + - `os` + - `architecture` + - `variant` (if specified) + - `io.buildpacks.distribution.name` (if specified) + - `io.buildpacks.distribution.version` (if specified) ##### Outputs | Output | Description @@ -955,22 +967,24 @@ A more thorough explanation is provided in the [Buildpack Interface Specificatio ### Environment #### Buildpack Environment -##### Stack-Provided Variables -The following variables SHOULD be set in the lifecycle execution environment and SHALL be directly inherited by the buildpack without modification: -| Env Variable | Description -|-----------------|-------------------------------------- -| `CNB_STACK_ID` | Chosen stack ID -| `HOME` | Current user's home directory +##### Base Image-Provided Variables + +The following variables SHOULD be set in the lifecycle execution environment and SHALL be directly inherited by the +buildpack without modification: + +| Env Variable | Description | +|-----------------------------|--------------------------------| +| `HOME` | Current user's home directory | The following variables SHOULD be set in the lifecycle execution environment and MAY be modified by prior buildpacks before they are provided to a given buildpack: -| Env Variable | Layer Path | Contents -|-------------------|--------------|------------------ -| `PATH` | `/bin` | binaries -| `LD_LIBRARY_PATH` | `/lib` | shared libraries -| `LIBRARY_PATH` | `/lib` | static libraries -| `CPATH` | `/include` | header files -| `PKG_CONFIG_PATH` | `/pkgconfig` | pc files +| Env Variable | Layer Path | Contents | +|-------------------|--------------|------------------| +| `PATH` | `/bin` | binaries | +| `LD_LIBRARY_PATH` | `/lib` | shared libraries | +| `LIBRARY_PATH` | `/lib` | static libraries | +| `CPATH` | `/include` | header files | +| `PKG_CONFIG_PATH` | `/pkgconfig` | pc files | The platform SHOULD NOT assume any other stack-provided environment variables are inherited by the buildpack. @@ -985,7 +999,7 @@ The platform SHOULD NOT set user-provided environment variables directly in the #### Launch Environment User-provided modifications to the process execution environment SHOULD be set directly in the lifecycle execution environment. -The process SHALL inherit both stack-provided and user-provided variables from the lifecycle execution environment with the following exceptions: +The process SHALL inherit both base-image-provided and user-provided variables from the lifecycle execution environment with the following exceptions: * `CNB_APP_DIR`, `CNB_LAYERS_DIR` and `CNB_PROCESS_TYPE` SHALL NOT be set in the process execution environment. * `/cnb/process` SHALL be removed from the beginning of `PATH`. * The lifecycle SHALL apply buildpack-provided modifications to the environment as outlined in the [Buildpack Interface Specification](buildpack.md). @@ -1030,15 +1044,23 @@ For more information on build reproducibility see [https://reproducible-builds.o [run-image] reference = "" + target-id = "" + [platform] + os = "" + arch = "" + variant = "" + distro-name = "" [build-image] reference = "" ``` Where: -- `previous-image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon +- `image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon +- `image.metadata` MUST be the TOML representation of the layer [metadata label](#iobuildpackslifecyclemetadata-json) - `run-image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon -- `previous-image.metadata` MUST be the TOML representation of the layer [metadata label](#iobuildpackslifecyclemetadata-json) +- `run-image.target-id` is optional and MUST be the value of the label `io.buildpacks.id` +- `run-image.platform` contains the [platform data](#TODO) for the image #### `group.toml` (TOML) From 4531d8cf44f1e69ade030124a516367773963037 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Dec 2022 16:11:56 -0500 Subject: [PATCH 03/46] Format TOC, fix TODO Signed-off-by: Natalie Arellano --- platform.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/platform.md b/platform.md index 27391ac..29e0629 100644 --- a/platform.md +++ b/platform.md @@ -19,11 +19,9 @@ Examples of a platform might include: - [Terminology](#terminology) - [CNB Terminology](#cnb-terminology) - [Additional Terminology](#additional-terminology) - - [Stacks](#stacks) - - [Stack ID](#stack-id) - [Build Image](#build-image) - [Run Image](#run-image) - - [Mixins](#mixins) + - [Platform Data](#platform-data) - [Compatibility Guarantees](#compatibility-guarantees) - [Lifecycle Interface](#lifecycle-interface) - [Platform API Compatibility](#platform-api-compatibility) @@ -59,6 +57,7 @@ Examples of a platform might include: - [Outputs](#outputs-7) - [`launcher`](#launcher) - [Inputs](#inputs-8) + - [Execution](#execution) - [Outputs](#outputs-8) - [Run Image Resolution](#run-image-resolution) - [Registry Authentication](#registry-authentication) @@ -71,7 +70,7 @@ Examples of a platform might include: - [Additional Guidance](#additional-guidance) - [Environment](#environment) - [Buildpack Environment](#buildpack-environment) - - [Stack-Provided Variables](#stack-provided-variables) + - [Base Image-Provided Variables](#base-image-provided-variables) - [User-Provided Variables](#user-provided-variables) - [Launch Environment](#launch-environment) - [Caching](#caching) @@ -1060,7 +1059,7 @@ Where: - `image.metadata` MUST be the TOML representation of the layer [metadata label](#iobuildpackslifecyclemetadata-json) - `run-image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon - `run-image.target-id` is optional and MUST be the value of the label `io.buildpacks.id` -- `run-image.platform` contains the [platform data](#TODO) for the image +- `run-image.platform` contains the [platform data](#platform-data) for the image #### `group.toml` (TOML) From 58904f26920277e2fa19b01fd513670afcfca519 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Dec 2022 16:18:38 -0500 Subject: [PATCH 04/46] Add derive missing values for known stack ID Signed-off-by: Natalie Arellano --- platform.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platform.md b/platform.md index 29e0629..73996c7 100644 --- a/platform.md +++ b/platform.md @@ -1046,9 +1046,10 @@ For more information on build reproducibility see [https://reproducible-builds.o target-id = "" [platform] os = "" - arch = "" + architecture = "" variant = "" distro-name = "" + distro-version = "" [build-image] reference = "" @@ -1060,6 +1061,11 @@ Where: - `run-image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon - `run-image.target-id` is optional and MUST be the value of the label `io.buildpacks.id` - `run-image.platform` contains the [platform data](#platform-data) for the image + - If platform data is missing but the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: + - `run-image.platform.os = "linux"` + - `run-image.platform.architecture = "x86_64"` + - `run-image.platform.distro-name = "ubuntu"` + - `run-image.platform.distro-version = "18.04"` #### `group.toml` (TOML) From 3140c7db6d2a39c1c7924b727f53fd3216db0ad2 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Dec 2022 16:21:11 -0500 Subject: [PATCH 05/46] Add guidance around SBOM and rebase Signed-off-by: Natalie Arellano --- platform.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform.md b/platform.md index 73996c7..f492aa6 100644 --- a/platform.md +++ b/platform.md @@ -249,6 +249,10 @@ Rebasing allows for fast runtime OS-level dependency updates for app images with To rebase an app image a platform MUST execute the `/cnb/lifecycle/rebaser` or perform an equivalent operation. +If an SBOM is available, platforms MAY: +- Warn when a rebase operation would add OS packages. +- Fail if a rebase operation would remove OS packages. + #### Launch `/cnb/lifecycle/launcher` is responsible for launching user and buildpack provided processes in the correct execution environment. `/cnb/lifecycle/launcher`, or a symlink to it (see [exporter outputs](#outputs-4)), SHALL be the `ENTRYPOINT` for all app images. From f31e623e17e55278704ca0275440256072391dcf Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Dec 2022 16:32:53 -0500 Subject: [PATCH 06/46] Fix nesting Signed-off-by: Natalie Arellano --- platform.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.md b/platform.md index f492aa6..45606bc 100644 --- a/platform.md +++ b/platform.md @@ -21,7 +21,7 @@ Examples of a platform might include: - [Additional Terminology](#additional-terminology) - [Build Image](#build-image) - [Run Image](#run-image) - - [Platform Data](#platform-data) + - [Platform Data](#platform-data) - [Compatibility Guarantees](#compatibility-guarantees) - [Lifecycle Interface](#lifecycle-interface) - [Platform API Compatibility](#platform-api-compatibility) @@ -186,7 +186,7 @@ The platform SHOULD ensure that: - The image config's `Label` field has the label `io.buildpacks.base.description` set to the description of the image. - The image config's `Label` field has the label `io.buildpacks.base.metadata` set to additional metadata related to the image. -#### Platform Data +### Platform Data For both build images and run images, the platform MUST ensure that: From c58ae52a92272a73dd81079d43495b2ca32491c2 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Dec 2022 16:35:55 -0500 Subject: [PATCH 07/46] Remove language about a "contract" Signed-off-by: Natalie Arellano --- platform.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/platform.md b/platform.md index 45606bc..fe8058b 100644 --- a/platform.md +++ b/platform.md @@ -170,8 +170,6 @@ A typical run image might specify: * Trusted CA certificates in the launch environment. * The default user in the run environment. -Run image authors SHOULD define the contract such that any CVEs can be addressed with security patches without violating the [compatibility guarantees](#compatibility-guarantees). - The platform MUST ensure that: - The image config's `Env` field has the environment variable `PATH` set to a valid set of paths or explicitly set to empty (`PATH=`). From cac2d6e009d5719dba2ca25ca6bbfb4cf1cbfbdb Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Dec 2022 16:55:23 -0500 Subject: [PATCH 08/46] Describe how analyzed is used by the detector Signed-off-by: Natalie Arellano --- platform.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform.md b/platform.md index fe8058b..c4a6d2b 100644 --- a/platform.md +++ b/platform.md @@ -337,8 +337,8 @@ The platform MUST execute `detector` in the **build environment** Usage: ``` /cnb/lifecycle/detector \ - [-app ] \ [-analyzed ] \ + [-app ] \ [-buildpacks ] \ [-extensions ] \ [-generated ] \ @@ -353,7 +353,7 @@ Usage: ##### Inputs | Input | Environment Variable | Default Value | Description | |----------------|----------------------|--------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `` | `CNB_ANALYZED_PATH` | `/analyzed.toml` | (**[experimental](#experimental-features)**) Path to output analysis metadata (see [`analyzed.toml`](#analyzedtoml-toml) | +| `` | `CNB_ANALYZED_PATH` | `/analyzed.toml` | Path to output analysis metadata (see [`analyzed.toml`](#analyzedtoml-toml) | | `` | `CNB_APP_DIR` | `/workspace` | Path to application directory | | `` | `CNB_BUILDPACKS_DIR` | `/cnb/buildpacks` | Path to buildpacks directory (see [Buildpacks Directory Layout](#buildpacks-directory-layout)) | | `` | `CNB_EXTENSIONS_DIR` | `/cnb/extensions` | (**[experimental](#experimental-features)**) Path to image extensions directory (see [Image Extensions Directory Layout](#image-extensions-directory-layout) | @@ -393,6 +393,7 @@ Usage: The lifecycle: - SHALL detect a single group from `` and write it to `` using the [detection process](buildpack.md#phase-1-detection) outlined in the Buildpack Interface Specification - SHALL write the resolved build plan from the detected group to `` +- SHALL provide `run-image.platform` data in `` to buildpacks according to the process outlined in the [Buildpack Interface Specification](buildpack.md). When image extensions are present in the order (**[experimental](#experimental-features)**), the lifecycle: - SHALL execute all image extensions in the order defined in `` according to the process outlined in the [Buildpack Interface Specification](buildpack.md). From d6141f2f8c632bba353c394aa74f0d2aa741a572 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 6 Dec 2022 10:26:49 -0500 Subject: [PATCH 09/46] Remove other references to stack Signed-off-by: Natalie Arellano --- platform.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform.md b/platform.md index c4a6d2b..41d0321 100644 --- a/platform.md +++ b/platform.md @@ -806,7 +806,7 @@ Usage: - The value of `io.buildpacks.lifecycle.metadata` SHALL be modified as follows - `run-image.reference` SHALL uniquely identify `` - `run-image.top-layer` SHALL be set to the uncompressed digest of the top layer in `` - - The value of `io.buildpacks.stack.*` labels SHALL be modified to that of the new `run-image` + - The value of `io.buildpacks.base.*` labels SHALL be modified to that of the new `run-image` - To ensure [build reproducibility](#build-reproducibility), the lifecycle: - SHOULD set the `created` time in image config to a constant @@ -914,7 +914,7 @@ The launcher: ### Run Image Resolution -Given stack metadata containing `run-image.image` and a set of `run-image.mirrors`. The `` for a given `` shall be resolved as follows: +Given [stack](#stacktoml-toml) metadata containing `run-image.image` and a set of `run-image.mirrors`. The `` for a given `` shall be resolved as follows: - **If** any of `run-image.image` or `run-image.mirrors` has a registry matching that of ``, this value will become the `` - **If** none of `run-image.image` or `run-image.mirrors` has a registry matching that of ``, `` will become the `` @@ -988,7 +988,7 @@ The following variables SHOULD be set in the lifecycle execution environment and | `CPATH` | `/include` | header files | | `PKG_CONFIG_PATH` | `/pkgconfig` | pc files | -The platform SHOULD NOT assume any other stack-provided environment variables are inherited by the buildpack. +The platform SHOULD NOT assume any other base-image-provided environment variables are inherited by the buildpack. ##### User-Provided Variables User-provided environment variables MUST be supplied by the platform as files in the `/env/` directory. From 10293e9549c1857d9894c664ccd6a588cdd0300d Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 6 Dec 2022 10:29:38 -0500 Subject: [PATCH 10/46] Rename platform -> target Signed-off-by: Natalie Arellano --- platform.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platform.md b/platform.md index 41d0321..87a3cef 100644 --- a/platform.md +++ b/platform.md @@ -21,7 +21,7 @@ Examples of a platform might include: - [Additional Terminology](#additional-terminology) - [Build Image](#build-image) - [Run Image](#run-image) - - [Platform Data](#platform-data) + - [Target Data](#target-data) - [Compatibility Guarantees](#compatibility-guarantees) - [Lifecycle Interface](#lifecycle-interface) - [Platform API Compatibility](#platform-api-compatibility) @@ -184,7 +184,7 @@ The platform SHOULD ensure that: - The image config's `Label` field has the label `io.buildpacks.base.description` set to the description of the image. - The image config's `Label` field has the label `io.buildpacks.base.metadata` set to additional metadata related to the image. -### Platform Data +### Target Data For both build images and run images, the platform MUST ensure that: @@ -1047,7 +1047,7 @@ For more information on build reproducibility see [https://reproducible-builds.o [run-image] reference = "" target-id = "" - [platform] + [target] os = "" architecture = "" variant = "" @@ -1063,8 +1063,8 @@ Where: - `image.metadata` MUST be the TOML representation of the layer [metadata label](#iobuildpackslifecyclemetadata-json) - `run-image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon - `run-image.target-id` is optional and MUST be the value of the label `io.buildpacks.id` -- `run-image.platform` contains the [platform data](#platform-data) for the image - - If platform data is missing but the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: +- `run-image.platform` contains the [target data](#target-data) for the image + - If target data is missing but the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: - `run-image.platform.os = "linux"` - `run-image.platform.architecture = "x86_64"` - `run-image.platform.distro-name = "ubuntu"` From ec8769e0b392fa20d2bee03281e4a26a74976b3d Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 6 Dec 2022 10:43:26 -0500 Subject: [PATCH 11/46] Small syntax change Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index 87a3cef..6c3d178 100644 --- a/platform.md +++ b/platform.md @@ -196,7 +196,7 @@ The platform SHOULD ensure that: - The image config's `variant` field is set to a valid identifier as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). - The image config's `Label` field has the label `io.buildpacks.distribution.name` set to the OS distribution and the label `io.buildpacks.distribution.version` set to the OS distribution version. - For Linux-based images, each field should be the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`), as the `os.version` field in an image config may contain combined distribution and version information. - - For Windows-based images, distribution should be empty. Version should be the value of `os.version` in the image config (e.g., `10.0.14393.1066`). + - For Windows-based images, distribution should be empty; version should be the value of `os.version` in the image config (e.g., `10.0.14393.1066`). ### Compatibility Guarantees From 0373ea9f2a1bb94d072807eac5286eb1d48cade9 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 6 Dec 2022 10:49:48 -0500 Subject: [PATCH 12/46] Rename architecture -> arch to match buildpack spec Signed-off-by: Natalie Arellano --- platform.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platform.md b/platform.md index 6c3d178..ac304e5 100644 --- a/platform.md +++ b/platform.md @@ -1049,7 +1049,7 @@ For more information on build reproducibility see [https://reproducible-builds.o target-id = "" [target] os = "" - architecture = "" + arch = "" variant = "" distro-name = "" distro-version = "" @@ -1065,10 +1065,10 @@ Where: - `run-image.target-id` is optional and MUST be the value of the label `io.buildpacks.id` - `run-image.platform` contains the [target data](#target-data) for the image - If target data is missing but the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: - - `run-image.platform.os = "linux"` - - `run-image.platform.architecture = "x86_64"` - - `run-image.platform.distro-name = "ubuntu"` - - `run-image.platform.distro-version = "18.04"` + - `run-image.target.os = "linux"` + - `run-image.target.arch = "x86_64"` + - `run-image.target.distro-name = "ubuntu"` + - `run-image.target.distro-version = "18.04"` #### `group.toml` (TOML) From 941516ee286b7fb8387054f7a8de7bd4068cb167 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 6 Dec 2022 11:38:39 -0500 Subject: [PATCH 13/46] Wording Signed-off-by: Natalie Arellano --- platform.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.md b/platform.md index ac304e5..eeffac4 100644 --- a/platform.md +++ b/platform.md @@ -195,8 +195,8 @@ The platform SHOULD ensure that: - The image config's `variant` field is set to a valid identifier as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). - The image config's `Label` field has the label `io.buildpacks.distribution.name` set to the OS distribution and the label `io.buildpacks.distribution.version` set to the OS distribution version. - - For Linux-based images, each field should be the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`), as the `os.version` field in an image config may contain combined distribution and version information. - - For Windows-based images, distribution should be empty; version should be the value of `os.version` in the image config (e.g., `10.0.14393.1066`). + - For Linux-based images, each label should contain the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`), as the `os.version` field in an image config may contain combined distribution and version information. + - For Windows-based images, `io.buildpacks.distribution.name` should be empty; `io.buildpacks.distribution.version` should contain the value of `os.version` in the image config (e.g., `10.0.14393.1066`). ### Compatibility Guarantees From b3c883b24148d275bfa18917f0c3e4d2868d3e80 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 6 Dec 2022 12:14:59 -0500 Subject: [PATCH 14/46] Rename distro -> distribution and update schema of analyzed.toml to match buildpack spec Signed-off-by: Natalie Arellano --- platform.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/platform.md b/platform.md index eeffac4..0ef65ae 100644 --- a/platform.md +++ b/platform.md @@ -1048,11 +1048,12 @@ For more information on build reproducibility see [https://reproducible-builds.o reference = "" target-id = "" [target] - os = "" - arch = "" - variant = "" - distro-name = "" - distro-version = "" + os = "" + arch = "" + variant = "" + [target.distribution] + name = "" + version = "" [build-image] reference = "" @@ -1067,8 +1068,8 @@ Where: - If target data is missing but the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: - `run-image.target.os = "linux"` - `run-image.target.arch = "x86_64"` - - `run-image.target.distro-name = "ubuntu"` - - `run-image.target.distro-version = "18.04"` + - `run-image.target.distribution.name = "ubuntu"` + - `run-image.target.distribution.version = "18.04"` #### `group.toml` (TOML) From 64d392cc342674ec74b71d98f65ec0769864779b Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 6 Dec 2022 12:18:00 -0500 Subject: [PATCH 15/46] More rename platform -> target Signed-off-by: Natalie Arellano --- platform.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.md b/platform.md index 0ef65ae..82451e6 100644 --- a/platform.md +++ b/platform.md @@ -393,7 +393,7 @@ Usage: The lifecycle: - SHALL detect a single group from `` and write it to `` using the [detection process](buildpack.md#phase-1-detection) outlined in the Buildpack Interface Specification - SHALL write the resolved build plan from the detected group to `` -- SHALL provide `run-image.platform` data in `` to buildpacks according to the process outlined in the [Buildpack Interface Specification](buildpack.md). +- SHALL provide `run-image.target` data in `` to buildpacks according to the process outlined in the [Buildpack Interface Specification](buildpack.md). When image extensions are present in the order (**[experimental](#experimental-features)**), the lifecycle: - SHALL execute all image extensions in the order defined in `` according to the process outlined in the [Buildpack Interface Specification](buildpack.md). @@ -1064,7 +1064,7 @@ Where: - `image.metadata` MUST be the TOML representation of the layer [metadata label](#iobuildpackslifecyclemetadata-json) - `run-image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon - `run-image.target-id` is optional and MUST be the value of the label `io.buildpacks.id` -- `run-image.platform` contains the [target data](#target-data) for the image +- `run-image.target` contains the [target data](#target-data) for the image - If target data is missing but the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: - `run-image.target.os = "linux"` - `run-image.target.arch = "x86_64"` From 796133ad329c3cdbb30b8b1f6cec434eba20557c Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 2 Feb 2023 18:06:27 -0500 Subject: [PATCH 16/46] Apply suggestions from code review Signed-off-by: Natalie Arellano --- platform.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform.md b/platform.md index 82451e6..ae0dea2 100644 --- a/platform.md +++ b/platform.md @@ -806,7 +806,7 @@ Usage: - The value of `io.buildpacks.lifecycle.metadata` SHALL be modified as follows - `run-image.reference` SHALL uniquely identify `` - `run-image.top-layer` SHALL be set to the uncompressed digest of the top layer in `` - - The value of `io.buildpacks.base.*` labels SHALL be modified to that of the new `run-image` + - The value of `io.buildpacks.base.*` labels (and any `io.buildpacks.stack.*` labels, if present) SHALL be modified to that of the new `run-image` - To ensure [build reproducibility](#build-reproducibility), the lifecycle: - SHOULD set the `created` time in image config to a constant @@ -1046,8 +1046,8 @@ For more information on build reproducibility see [https://reproducible-builds.o [run-image] reference = "" - target-id = "" [target] + id = "" os = "" arch = "" variant = "" @@ -1063,7 +1063,7 @@ Where: - `image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon - `image.metadata` MUST be the TOML representation of the layer [metadata label](#iobuildpackslifecyclemetadata-json) - `run-image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon -- `run-image.target-id` is optional and MUST be the value of the label `io.buildpacks.id` +- `run-image.target.id` is optional and MUST be the value of the label `io.buildpacks.id` - `run-image.target` contains the [target data](#target-data) for the image - If target data is missing but the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: - `run-image.target.os = "linux"` From 4480ba799723495e096795ecf7edc91ccf8492e2 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 2 Feb 2023 17:32:09 -0500 Subject: [PATCH 17/46] Rename stack.toml to run.toml and validate run image selection against run.toml Signed-off-by: Natalie Arellano --- platform.md | 131 +++++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 64 deletions(-) diff --git a/platform.md b/platform.md index ae0dea2..afa5344 100644 --- a/platform.md +++ b/platform.md @@ -84,7 +84,7 @@ Examples of a platform might include: - [`plan.toml` (TOML)](#plantoml-toml) - [`project-metadata.toml` (TOML)](#project-metadatatoml-toml) - [`report.toml` (TOML)](#reporttoml-toml) - - [`stack.toml` (TOML)](#stacktoml-toml) + - [`run.toml` (TOML)](#runtoml-toml) - [Labels](#labels) - [`io.buildpacks.build.metadata` (JSON)](#iobuildpacksbuildmetadata-json) - [`io.buildpacks.lifecycle.metadata` (JSON)](#iobuildpackslifecyclemetadata-json) @@ -275,31 +275,31 @@ Usage: [-layers ] \ [-log-level ] \ [-previous-image ] \ + [-run ] \ [-run-image ] \ [-skip-layers ] \ - [-stack ] \ [-tag ...] \ [-uid ] \ ``` ##### Inputs -| Input | Environment Variable | Default Value | Description -|-------------------|-----------------------|--------------------------|---------------------- -| `` | `CNB_ANALYZED_PATH` | `/analyzed.toml` | Path to output analysis metadata (see [`analyzed.toml`](#analyzedtoml-toml) -| `` | `CNB_CACHE_IMAGE` | | Reference to a cache image in an OCI registry -| `` | `CNB_USE_DAEMON` | `false` | Analyze image from docker daemon -| `` | `CNB_GROUP_ID` | | Primary GID of the build image `User` -| `` | `CNB_LAYERS_DIR` | `/layers` | Path to layers directory -| `` | | | Tag reference to which the app image will be written -| `` | `CNB_LAUNCH_CACHE_DIR`| | Path to a cache directory containing launch layers -| `` | `CNB_LOG_LEVEL` | `info` | Log Level -| ``| `CNB_PREVIOUS_IMAGE` | `` | Image reference to be analyzed (usually the result of the previous build) -| `` | `CNB_RUN_IMAGE` | resolved from `` | Run image reference -| `` | `CNB_SKIP_LAYERS` | `false` | Do not restore SBOM layer from previous image -| `` | `CNB_STACK_PATH` | `/cnb/stack.toml` | Path to stack file (see [`stack.toml`](#stacktoml-toml)) -| `...` | | | Additional tag to apply to exported image -| `` | `CNB_USER_ID` | | UID of the build image `User` +| Input | Environment Variable | Default Value | Description | +|--------------------|------------------------|--------------------------|-----------------------------------------------------------------------------| +| `` | `CNB_ANALYZED_PATH` | `/analyzed.toml` | Path to output analysis metadata (see [`analyzed.toml`](#analyzedtoml-toml) | +| `` | `CNB_CACHE_IMAGE` | | Reference to a cache image in an OCI registry | +| `` | `CNB_USE_DAEMON` | `false` | Analyze image from docker daemon | +| `` | `CNB_GROUP_ID` | | Primary GID of the build image `User` | +| `` | `CNB_LAYERS_DIR` | `/layers` | Path to layers directory | +| `` | | | Tag reference to which the app image will be written | +| `` | `CNB_LAUNCH_CACHE_DIR` | | Path to a cache directory containing launch layers | +| `` | `CNB_LOG_LEVEL` | `info` | Log Level | +| `` | `CNB_PREVIOUS_IMAGE` | `` | Image reference to be analyzed (usually the result of the previous build) | +| `` | `CNB_RUN_PATH` | `/cnb/run.toml` | Path to run file (see [`run.toml`](#runtoml-toml)) | +| `` | `CNB_RUN_IMAGE` | resolved from `` | Run image reference | +| `` | `CNB_SKIP_LAYERS` | `false` | Do not restore SBOM layer from previous image | +| `...` | | | Additional tag to apply to exported image | +| `` | `CNB_USER_ID` | | UID of the build image `User` | -`` MUST be a valid image reference - **If** the platform provides one or more `` inputs, each `` MUST be a valid image reference. @@ -307,7 +307,7 @@ Usage: - **If** `` is `false`, ``, if provided, MUST be a valid image reference. - **If** `` is `true`, ``, if provided, MUST be either a valid image reference or an imageID. - **If** `` is `true` the lifecycle MUST NOT restore the SBOM layer (if any) from the previous image. -- **If** `` is not provided by the platform the lifecycle MUST [resolve](#run-image-resolution) the run image from the contents of `stack` or fail if `stack` does not contain a valid run image. +- **If** `` is not provided by the platform the lifecycle MUST [resolve](#run-image-resolution) the run image from the contents of `run` or fail if `run` does not contain a valid run image. - The lifecycle MUST accept valid references to non-existent ``, ``, and `` without error. - The lifecycle MUST ensure registry write access to ``, `` and any provided ``s. - The lifecycle MUST ensure registry read access to ``, ``, and ``. @@ -347,7 +347,8 @@ Usage: [-log-level ] \ [-order ] \ [-plan ] \ - [-platform ] + [-platform ] \ + [-run ] ``` ##### Inputs @@ -364,6 +365,7 @@ Usage: | `` | `CNB_ORDER_PATH` | `/order.toml` if present, or `/cnb/order.toml` | Path resolution for order definition (see [`order.toml`](#ordertoml-toml)) | | `` | `CNB_PLAN_PATH` | `/plan.toml` | Path to output resolved build plan | | `` | `CNB_PLATFORM_DIR` | `/platform` | Path to platform directory | +| `` | `CNB_RUN_PATH` | `/cnb/run.toml` | Path to run file (see [`run.toml`](#runtoml-toml)) | ##### Outputs | Output | Description | @@ -593,33 +595,33 @@ Usage: [-process-type ] \ [-project-metadata ] \ [-report ] \ - [-stack ] \ + [-run ] \ [-uid ] \ [...] ``` ##### Inputs -| Input | Environment Variable | Default Value | Description -|---------------------|----------------------------|---------------------|--------------------------------------- -| `` | `CNB_ANALYZED_PATH` | `/analyzed.toml` | Path to analysis metadata (see [`analyzed.toml`](#analyzedtoml-toml) -| `` | `CNB_APP_DIR` | `/workspace` | Path to application directory -| `` | `CNB_CACHE_DIR` | | Path to a cache directory -| `` | `CNB_CACHE_IMAGE` | | Reference to a cache image in an OCI registry -| `` | `CNB_USE_DAEMON` | `false` | Export image to docker daemon -| `` | `CNB_GROUP_ID` | | Primary GID of the build image `User` -| `` | `CNB_GROUP_PATH` | `/group.toml` | Path to group file (see [`group.toml`](#grouptoml-toml)) -| `` | | | Tag reference to which the app image will be written -| `` | `CNB_LAUNCH_CACHE_DIR` | | Path to a cache directory containing launch layers -| `` | | `/cnb/lifecycle/launcher` | Path to the `launcher` executable -| `` | `CNB_LAYERS_DIR` | `/layers` | Path to layer directory -| `` | `CNB_LOG_LEVEL` | `info` | Log Level -| `` | `CNB_PROCESS_TYPE` | | Default process type to set in the exported image -| ``| `CNB_PROJECT_METADATA_PATH`| `/project-metadata.toml` | Path to a project metadata file (see [`project-metadata.toml`](#project-metadatatoml-toml) -| `` | `CNB_REPORT_PATH` | `/report.toml` | Path to report (see [`report.toml`](#reporttoml-toml) -| `` | `CNB_STACK_PATH` | `/cnb/stack.toml` | Path to stack file (see [`stack.toml`](#stacktoml-toml) -| `` | `CNB_USER_ID` | | UID of the build image `User` -| `/config/metadata.toml` | | | Build metadata (see [`metadata.toml`](#metadatatoml-toml) -| | `SOURCE_DATE_EPOCH` | | Timestamp for `created` time in app image config | +| Input | Environment Variable | Default Value | Description | +|---------------------------------|-----------------------------|----------------------------------|--------------------------------------------------------------------------------------------| +| `` | `CNB_ANALYZED_PATH` | `/analyzed.toml` | Path to analysis metadata (see [`analyzed.toml`](#analyzedtoml-toml) | +| `` | `CNB_APP_DIR` | `/workspace` | Path to application directory | +| `` | `CNB_CACHE_DIR` | | Path to a cache directory | +| `` | `CNB_CACHE_IMAGE` | | Reference to a cache image in an OCI registry | +| `` | `CNB_USE_DAEMON` | `false` | Export image to docker daemon | +| `` | `CNB_GROUP_ID` | | Primary GID of the build image `User` | +| `` | `CNB_GROUP_PATH` | `/group.toml` | Path to group file (see [`group.toml`](#grouptoml-toml)) | +| `` | | | Tag reference to which the app image will be written | +| `` | `CNB_LAUNCH_CACHE_DIR` | | Path to a cache directory containing launch layers | +| `` | | `/cnb/lifecycle/launcher` | Path to the `launcher` executable | +| `` | `CNB_LAYERS_DIR` | `/layers` | Path to layer directory | +| `` | `CNB_LOG_LEVEL` | `info` | Log Level | +| `` | `CNB_PROCESS_TYPE` | | Default process type to set in the exported image | +| `` | `CNB_PROJECT_METADATA_PATH` | `/project-metadata.toml` | Path to a project metadata file (see [`project-metadata.toml`](#project-metadatatoml-toml) | +| `` | `CNB_REPORT_PATH` | `/report.toml` | Path to report (see [`report.toml`](#reporttoml-toml) | +| `` | `CNB_RUN_PATH` | `/cnb/run.toml` | Path to run file (see [`run.toml`](#runtoml-toml) | +| `` | `CNB_USER_ID` | | UID of the build image `User` | +| `/config/metadata.toml` | | | Build metadata (see [`metadata.toml`](#metadatatoml-toml) | +| | `SOURCE_DATE_EPOCH` | | Timestamp for `created` time in app image config | - At least one `` must be provided - Each `` MUST be a valid tag reference @@ -711,9 +713,9 @@ Usage: [-process-type ] \ [-project-metadata ] \ [-report ] \ + [-run ] \ [-run-image ] \ [-skip-restore ] \ - [-stack ] \ [-tag ...] \ [-uid ] \ @@ -775,8 +777,8 @@ Usage: - At least one `` must be provided - Each `` MUST be a valid tag reference - **If** `` is `false` and more than one `` is provided, the images MUST refer to the same registry -- **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `stack` key in the `io.buildpacks.lifecycle.metdata` label on `` -- **If** `` is true the following values in the output `` config MUST be derived from the new ``, or else they MUST match the old run image if `` is false: +- **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `runImage` key in the `io.buildpacks.lifecycle.metdata` label on `` +- **If** `` is `true` the following values in the output `` config MUST be derived from the new ``, or else they MUST match the old run image if `` is `false`: - `os` - `architecture` - `variant` (if specified) @@ -914,9 +916,12 @@ The launcher: ### Run Image Resolution -Given [stack](#stacktoml-toml) metadata containing `run-image.image` and a set of `run-image.mirrors`. The `` for a given `` shall be resolved as follows: -- **If** any of `run-image.image` or `run-image.mirrors` has a registry matching that of ``, this value will become the `` -- **If** none of `run-image.image` or `run-image.mirrors` has a registry matching that of ``, `` will become the `` +Given [run](#runtoml-toml) metadata, the `` for a given `` shall be resolved as follows: +- From the matching `[[image]]`: + - **If** the tag reference for the run image is known (e.g., from a `-run-image` argument), the `[[image]]` with matching `image` + - **Else** the first `[[image]]` +- **If** any of `[image.image]` or `[image.mirrors]` has a registry matching that of ``, this value will become the `` +- **If** none of `[image.image]` or `[image.mirrors]` has a registry matching that of ``, `[image.image]` will become the `` ### Registry Authentication @@ -1199,21 +1204,21 @@ Where: - **If** the app image was exported to a docker daemon - `imageID` MUST contain the imageID -#### `stack.toml` (TOML) +#### `run.toml` (TOML) ```toml -[run-image] +[[image]] image = "" mirrors = ["", ""] ``` Where: -- `run-image.image` MAY be a reference to a run image in an OCI registry -- `run-image.mirrors` MUST NOT be present if `run-image.image` is not present -- `run-image.mirrors` MAY contain one or more tag references to run images in OCI registries -- All `run-image.mirrors`: - - SHOULD reference an image with ID identical to that of `run-image.image` -- `run-image.image` and `run-image.mirrors.[]` SHOULD each refer to a unique registry +- `image.image` MAY be a tag reference to a run image in an OCI registry +- `image.mirrors` MUST NOT be present if `image.image` is not present +- `image.mirrors` MAY contain one or more tag references to run images in OCI registries +- All `image.mirrors`: + - SHOULD reference an image with ID identical to that of `image.image` +- `image.image` and `image.mirrors.[]` SHOULD each refer to a unique registry ### Labels @@ -1296,13 +1301,10 @@ Where: } ], "runImage": { + "image": "cnbs/sample-stack-run:bionic", + "mirrors": = ["", ""], "topLayer": "", "reference": "" - }, - "stack": { - "runImage": { - "image": "cnbs/sample-stack-run:bionic" - } } } ``` @@ -1320,11 +1322,12 @@ Where: - The key MUST be the name of the layer - The value MUST contain JSON representation of the `layer.toml` with an additional `sha` key, containing the digest of the uncompressed layer - The value MUST contain an additional `sha` key, containing the digest of the uncompressed layer -- `run-image.topLayer` must contain the uncompressed digest of the top layer of the run-image -- `run-image.reference` MUST uniquely identify the run image. It MAY contain one of the following +- `runImage.image` MUST be a tag reference to the run-image +- `runImage.mirrors` MUST be selected from `run.toml` +- `runImage.topLayer` MUST contain the uncompressed digest of the top layer of the run-image +- `runImage.reference` MUST uniquely identify the run image. It MAY contain one of the following - An image ID (the digest of the uncompressed config blob) - A digest reference to a manifest stored in an OCI registry -- `stack` MUST contain the json representation of `stack.toml` #### `io.buildpacks.project.metadata` (JSON) From 7c905e171b756b687e44c8b037f98e7361281ddc Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 16 Feb 2023 13:11:46 -0500 Subject: [PATCH 18/46] Rename stack -> run Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index afa5344..aa83975 100644 --- a/platform.md +++ b/platform.md @@ -296,7 +296,7 @@ Usage: | `` | `CNB_LOG_LEVEL` | `info` | Log Level | | `` | `CNB_PREVIOUS_IMAGE` | `` | Image reference to be analyzed (usually the result of the previous build) | | `` | `CNB_RUN_PATH` | `/cnb/run.toml` | Path to run file (see [`run.toml`](#runtoml-toml)) | -| `` | `CNB_RUN_IMAGE` | resolved from `` | Run image reference | +| `` | `CNB_RUN_IMAGE` | resolved from `` | Run image reference | | `` | `CNB_SKIP_LAYERS` | `false` | Do not restore SBOM layer from previous image | | `...` | | | Additional tag to apply to exported image | | `` | `CNB_USER_ID` | | UID of the build image `User` | From 4de1087877002be79b4ece4236dc659d25445df4 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 16 Feb 2023 13:13:43 -0500 Subject: [PATCH 19/46] Detector doesn't need run without run image extension Signed-off-by: Natalie Arellano --- platform.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/platform.md b/platform.md index aa83975..1799855 100644 --- a/platform.md +++ b/platform.md @@ -348,7 +348,6 @@ Usage: [-order ] \ [-plan ] \ [-platform ] \ - [-run ] ``` ##### Inputs @@ -365,7 +364,6 @@ Usage: | `` | `CNB_ORDER_PATH` | `/order.toml` if present, or `/cnb/order.toml` | Path resolution for order definition (see [`order.toml`](#ordertoml-toml)) | | `` | `CNB_PLAN_PATH` | `/plan.toml` | Path to output resolved build plan | | `` | `CNB_PLATFORM_DIR` | `/platform` | Path to platform directory | -| `` | `CNB_RUN_PATH` | `/cnb/run.toml` | Path to run file (see [`run.toml`](#runtoml-toml)) | ##### Outputs | Output | Description | From 905754ee5791b093828b17c3aa07f65066693fc6 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 2 Mar 2023 16:09:52 -0500 Subject: [PATCH 20/46] Rename image -> images In lists we pluralize Signed-off-by: Natalie Arellano --- platform.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform.md b/platform.md index 1799855..fc07f05 100644 --- a/platform.md +++ b/platform.md @@ -915,9 +915,9 @@ The launcher: ### Run Image Resolution Given [run](#runtoml-toml) metadata, the `` for a given `` shall be resolved as follows: -- From the matching `[[image]]`: - - **If** the tag reference for the run image is known (e.g., from a `-run-image` argument), the `[[image]]` with matching `image` - - **Else** the first `[[image]]` +- From the matching `[[images]]`: + - **If** the tag reference for the run image is known (e.g., from a `-run-image` argument), the `[[images]]` with matching `image` + - **Else** the first `[[images]]` - **If** any of `[image.image]` or `[image.mirrors]` has a registry matching that of ``, this value will become the `` - **If** none of `[image.image]` or `[image.mirrors]` has a registry matching that of ``, `[image.image]` will become the `` @@ -1205,7 +1205,7 @@ Where: #### `run.toml` (TOML) ```toml -[[image]] +[[images]] image = "" mirrors = ["", ""] ``` From 7822f9a3d10804798de8d5fd645dc7a617bdf617 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 3 Mar 2023 11:59:25 -0500 Subject: [PATCH 21/46] Update platform.md Co-authored-by: Terence Lee Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index fc07f05..079da69 100644 --- a/platform.md +++ b/platform.md @@ -1070,7 +1070,7 @@ Where: - `run-image.target` contains the [target data](#target-data) for the image - If target data is missing but the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: - `run-image.target.os = "linux"` - - `run-image.target.arch = "x86_64"` + - `run-image.target.arch = "arm64"` - `run-image.target.distribution.name = "ubuntu"` - `run-image.target.distribution.version = "18.04"` From 381ee5390359ba7bd7d541173de49c9fa7e4e073 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 3 Mar 2023 12:28:49 -0500 Subject: [PATCH 22/46] Add back base image Signed-off-by: Natalie Arellano --- platform.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform.md b/platform.md index 2acc75d..e62b6de 100644 --- a/platform.md +++ b/platform.md @@ -103,6 +103,8 @@ Platform API versions: #### CNB Terminology A **buildpack** refers to software compliant with the [Buildpack Interface Specification](buildpack.md). +A **base image** is an OCI image containing the base, or initial set of layers, for other images. + A **build image** is an OCI image that provides the base of the **build environment**. A **run image** is an OCI image that provides the base from which **app images** are built. From 8efb92a3ff0d220ad501b72af12f620136fb56d7 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 3 Mar 2023 12:31:25 -0500 Subject: [PATCH 23/46] Update platform.md Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index e62b6de..b04d2a1 100644 --- a/platform.md +++ b/platform.md @@ -792,7 +792,7 @@ Usage: - **If** `` is `false` and more than one `` is provided, they MUST refer to the same registry - **If** `` is provided by the platform, the value will be used as the app image to rebase. `` must NOT be modified unless specified again in ``. - **Else** `` value will be derived from the first ``. -- **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `runImage` key in the `io.buildpacks.lifecycle.metdata` label on `` +- **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `runImage` key in the `io.buildpacks.lifecycle.metdata` label on ``. - **If** `` is `true` the following values in the output `` config MUST be derived from the new ``, or else they MUST match the old run image if `` is `false`: - `os` - `architecture` From 56a6557701e361d9b1ddb2cdf8526ffa27cc69ce Mon Sep 17 00:00:00 2001 From: Joe Kimmel Date: Sat, 8 Apr 2023 11:38:53 -0700 Subject: [PATCH 24/46] fixes link to image extension md file Signed-off-by: Joe Kimmel --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index d89ce04..f5de11d 100644 --- a/platform.md +++ b/platform.md @@ -128,7 +128,7 @@ A **launcher layer** refers to a layer in the app OCI image containing the **lau The **launcher** refers to a lifecycle executable packaged in the **app image** for the purpose of executing processes at runtime. -An **image extension** refers to software compliant with the [Image Extension Interface Specification](image-extension.md). Image extensions participate in detection and execute before the buildpack build process. +An **image extension** refers to software compliant with the [Image Extension Interface Specification](image_extension.md). Image extensions participate in detection and execute before the buildpack build process. #### Additional Terminology An **image reference** refers to either a **tag reference** or **digest reference**. From 417b853ebac06e4b7cb97854432fef907b421bf5 Mon Sep 17 00:00:00 2001 From: Hernan Garcia Date: Wed, 10 May 2023 11:07:30 -0500 Subject: [PATCH 25/46] add lifecycle output to update stack after rebase Signed-off-by: Hernan Garcia --- platform.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform.md b/platform.md index f5de11d..520c33b 100644 --- a/platform.md +++ b/platform.md @@ -822,7 +822,7 @@ Usage: | [exit status] | (see Exit Code table below for values) | `/dev/stdout` | Logs (info) | `/dev/stderr` | Logs (warnings, errors) -| `` | Rebased app image (see [Buildpack Interface Specfication](buildpack.md) +| `` | Rebased app image (see [Buildpack Interface Specfication](buildpack.md)) | Exit Code | Result| |-----------|-------| @@ -840,6 +840,8 @@ Usage: - `run-image.reference` SHALL uniquely identify `` - `run-image.top-layer` SHALL be set to the uncompressed digest of the top layer in `` - The value of `io.buildpacks.stack.*` labels SHALL be modified to that of the new `run-image` + - `stack.run-image.image` SHALL uniquely identify `` + - `stack.run-image.mirrors` SHALL be EMPTY - To ensure [build reproducibility](#build-reproducibility), the lifecycle: - SHOULD set the `created` time in image config to a constant From c05b08eefc01e2ab5742ccdc313ebd68a325f5c6 Mon Sep 17 00:00:00 2001 From: Hernan Garcia Date: Tue, 16 May 2023 09:38:34 -0500 Subject: [PATCH 26/46] Update platform.md Co-authored-by: Natalie Arellano Signed-off-by: Hernan Garcia --- platform.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform.md b/platform.md index 520c33b..f0053db 100644 --- a/platform.md +++ b/platform.md @@ -840,8 +840,9 @@ Usage: - `run-image.reference` SHALL uniquely identify `` - `run-image.top-layer` SHALL be set to the uncompressed digest of the top layer in `` - The value of `io.buildpacks.stack.*` labels SHALL be modified to that of the new `run-image` - - `stack.run-image.image` SHALL uniquely identify `` - - `stack.run-image.mirrors` SHALL be EMPTY +- **If** the provided `` is not found in `stack.run-image.image` or `stack.run-image.mirrors`: + - `stack.run-image.image` SHALL be the provided `` + - `stack.run-image.mirrors` SHALL be omitted - To ensure [build reproducibility](#build-reproducibility), the lifecycle: - SHOULD set the `created` time in image config to a constant From fb093a37ff2204c601573e56daa917b9c0468904 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 23 May 2023 12:18:11 -0400 Subject: [PATCH 27/46] Update platform.md Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index b04d2a1..d14961b 100644 --- a/platform.md +++ b/platform.md @@ -792,7 +792,7 @@ Usage: - **If** `` is `false` and more than one `` is provided, they MUST refer to the same registry - **If** `` is provided by the platform, the value will be used as the app image to rebase. `` must NOT be modified unless specified again in ``. - **Else** `` value will be derived from the first ``. -- **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `runImage` key in the `io.buildpacks.lifecycle.metdata` label on ``. +- **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `runImage` key in the `io.buildpacks.lifecycle.metdata` label on ``, or `stack.runImage` if not found (for compatibility with older platforms). - **If** `` is `true` the following values in the output `` config MUST be derived from the new ``, or else they MUST match the old run image if `` is `false`: - `os` - `architecture` From 8422bfedfda3407dda493ee33db10047377b7d37 Mon Sep 17 00:00:00 2001 From: Hernan Garcia Date: Tue, 23 May 2023 11:44:25 -0500 Subject: [PATCH 28/46] Update platform.md Co-authored-by: Natalie Arellano Signed-off-by: Hernan Garcia --- platform.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.md b/platform.md index 13a426b..46a9551 100644 --- a/platform.md +++ b/platform.md @@ -825,8 +825,8 @@ Usage: - `run-image.top-layer` SHALL be set to the uncompressed digest of the top layer in `` - The value of `io.buildpacks.stack.*` labels SHALL be modified to that of the new `run-image` - **If** the provided `` is not found in `stack.run-image.image` or `stack.run-image.mirrors`: - - `stack.run-image.image` SHALL be the provided `` - - `stack.run-image.mirrors` SHALL be omitted + - `run-image.image` SHALL be the provided `` + - `run-image.mirrors` SHALL be omitted - To ensure [build reproducibility](#build-reproducibility), the lifecycle: - SHOULD set the `created` time in image config to a constant From 32be97287fed1d2e29bcce2c6f9272f367c76767 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Wed, 31 May 2023 17:37:12 -0400 Subject: [PATCH 29/46] Update platform.md Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index 46a9551..a9e6809 100644 --- a/platform.md +++ b/platform.md @@ -824,7 +824,7 @@ Usage: - `run-image.reference` SHALL uniquely identify `` - `run-image.top-layer` SHALL be set to the uncompressed digest of the top layer in `` - The value of `io.buildpacks.stack.*` labels SHALL be modified to that of the new `run-image` -- **If** the provided `` is not found in `stack.run-image.image` or `stack.run-image.mirrors`: +- **If** the provided `` is not found in `runImage.image` or `runImage.mirrors`: - `run-image.image` SHALL be the provided `` - `run-image.mirrors` SHALL be omitted - To ensure [build reproducibility](#build-reproducibility), the lifecycle: From 46dc116a3b8810bc29757f73295409435f112f12 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Jun 2023 10:40:51 -0400 Subject: [PATCH 30/46] Apply suggestions from code review Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index 5cd8fdc..d2ba659 100644 --- a/platform.md +++ b/platform.md @@ -1101,7 +1101,7 @@ Where: - `run-image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon - `run-image.target.id` is optional and MUST be the value of the label `io.buildpacks.id` - `run-image.target` contains the [target data](#target-data) for the image - - If target data is missing but the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: + - If target distribution data is missing, it will be inferred from `/etc/os-release` for Linux images; furthermore, if the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: - `run-image.target.os = "linux"` - `run-image.target.arch = "arm64"` - `run-image.target.distribution.name = "ubuntu"` From 1fe9fd48afe3418ba1b7b67c2c039360a1c1ba25 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Jun 2023 10:41:06 -0400 Subject: [PATCH 31/46] Added -analyzed to builder Signed-off-by: Natalie Arellano --- platform.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/platform.md b/platform.md index d2ba659..6d87c86 100644 --- a/platform.md +++ b/platform.md @@ -536,6 +536,7 @@ The platform MUST execute `builder` in the **build environment** Usage: ``` /cnb/lifecycle/builder \ + [-analyzed ] \ [-app ] \ [-buildpacks ] \ [-build-config ] \ @@ -547,16 +548,17 @@ Usage: ``` ##### Inputs -| Input | Env | Default Value | Description | -|------------------|------------------------|-----------------------|------------------------------------------------------------------------------------------------| -| `` | `CNB_APP_DIR` | `/workspace` | Path to application directory | -| `` | `CNB_BUILD_CONFIG_DIR` | `/cnb/build-config` | Path to build config directory | -| `` | `CNB_BUILDPACKS_DIR` | `/cnb/buildpacks` | Path to buildpacks directory (see [Buildpacks Directory Layout](#buildpacks-directory-layout)) | -| `` | `CNB_GROUP_PATH` | `/group.toml` | Path to group definition (see [`group.toml`](#grouptoml-toml)) | -| `` | `CNB_LAYERS_DIR` | `/layers` | Path to layers directory | -| `` | `CNB_LOG_LEVEL` | `info` | Log Level | -| `` | `CNB_PLAN_PATH` | `/plan.toml` | Path to resolved build plan (see [`plan.toml`](#plantoml-toml)) | -| `` | `CNB_PLATFORM_DIR` | `/platform` | Path to platform directory | +| Input | Env | Default Value | Description | +|------------------|------------------------|--------------------------|------------------------------------------------------------------------------------------------| +| `` | `CNB_ANALYZED_PATH` | `/analyzed.toml` | Path to analysis metadata (see [`analyzed.toml`](#analyzedtoml-toml) | +| `` | `CNB_APP_DIR` | `/workspace` | Path to application directory | +| `` | `CNB_BUILD_CONFIG_DIR` | `/cnb/build-config` | Path to build config directory | +| `` | `CNB_BUILDPACKS_DIR` | `/cnb/buildpacks` | Path to buildpacks directory (see [Buildpacks Directory Layout](#buildpacks-directory-layout)) | +| `` | `CNB_GROUP_PATH` | `/group.toml` | Path to group definition (see [`group.toml`](#grouptoml-toml)) | +| `` | `CNB_LAYERS_DIR` | `/layers` | Path to layers directory | +| `` | `CNB_LOG_LEVEL` | `info` | Log Level | +| `` | `CNB_PLAN_PATH` | `/plan.toml` | Path to resolved build plan (see [`plan.toml`](#plantoml-toml)) | +| `` | `CNB_PLATFORM_DIR` | `/platform` | Path to platform directory | ##### Outputs | Output | Description @@ -578,6 +580,7 @@ Usage: | `50`, `52-59`| Build-specific lifecycle errors - The lifecycle SHALL execute all buildpacks in the order defined in `` according to the process outlined in the [Buildpack Interface Specification](buildpack.md). +- SHALL provide `run-image.target` data in `` to buildpacks according to the process outlined in the [Buildpack Interface Specification](buildpack.md). - The lifecycle SHALL add all invoked buildpacks to`/config/metadata.toml`. - The lifecycle SHALL aggregate all `processes` and `slices` returned by buildpacks in `/config/metadata.toml`. - The lifecycle SHALL record the buildpack-provided default process type in `/config/metadata.toml`. From 31dd9c3c94ea5c5ea005af047b9cc6563f13c768 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Jun 2023 12:35:14 -0400 Subject: [PATCH 32/46] `stack` key is deprecated. Signed-off-by: Natalie Arellano --- platform.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/platform.md b/platform.md index f01911a..02595bf 100644 --- a/platform.md +++ b/platform.md @@ -1386,3 +1386,24 @@ Where: } ``` This label MUST contain the JSON representation of [`project-metadata.toml`](#project-metadatatoml-toml) + + +## Deprecations +This section describes all the features that are deprecated. + +### `io.buildpacks.lifecycle.metadata` (JSON) `stack` Key + +_Deprecated in Platform API 0.12._ + +The `stack` key is deprecated. + +```json + "stack": { + "runImage": { + "image": "cnbs/sample-stack-run:bionic", + "mirrors": = ["", ""] + } + } +``` + +To upgrade, platform operators SHOULD read the same information from the `runImage` key. From a29f7fea62891f46da7c10c0f0e7f377702cb6a4 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Jun 2023 12:57:28 -0400 Subject: [PATCH 33/46] Apply suggestions from code review Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index 02595bf..d687678 100644 --- a/platform.md +++ b/platform.md @@ -350,7 +350,7 @@ Usage: [-log-level ] \ [-order ] \ [-plan ] \ - [-platform ] \ + [-platform ] ``` ##### Inputs From 2e06dd6c3b395c674584e94c3b5c66c255060e0a Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Jun 2023 13:00:38 -0400 Subject: [PATCH 34/46] Add more deprecations Signed-off-by: Natalie Arellano --- platform.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/platform.md b/platform.md index d687678..31bfbcd 100644 --- a/platform.md +++ b/platform.md @@ -1391,6 +1391,16 @@ This label MUST contain the JSON representation of [`project-metadata.toml`](#pr ## Deprecations This section describes all the features that are deprecated. +### `io.buildpacks.stack.*` Labels + +For compatibility with older platforms and older buildpacks, base image authors SHOULD ensure for build images and run images: + +- The image config's `Env` field has the environment variable `CNB_STACK_ID` set to the stack ID. +- The image config's `Label` field has the label `io.buildpacks.stack.id` set to the stack ID. +- The image config's `Label` field has the label `io.buildpacks.stack.mixins` set to a JSON array containing mixin names for each mixin applied to the image. + +To upgrade, the platform SHOULD upgrade all buildpacks to use Buildpack API `0.10` or greater. + ### `io.buildpacks.lifecycle.metadata` (JSON) `stack` Key _Deprecated in Platform API 0.12._ @@ -1401,9 +1411,9 @@ The `stack` key is deprecated. "stack": { "runImage": { "image": "cnbs/sample-stack-run:bionic", - "mirrors": = ["", ""] + "mirrors": ["", ""] } } ``` -To upgrade, platform operators SHOULD read the same information from the `runImage` key. +To upgrade, the platform SHOULD read the same information from the `runImage` key. From 9741479b7f8bb5f0a93bbe2b6b292aae52f8be13 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 5 Jun 2023 13:01:32 -0400 Subject: [PATCH 35/46] Add when labels were deprecated Signed-off-by: Natalie Arellano --- platform.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform.md b/platform.md index 31bfbcd..8266a20 100644 --- a/platform.md +++ b/platform.md @@ -1393,6 +1393,8 @@ This section describes all the features that are deprecated. ### `io.buildpacks.stack.*` Labels +_Deprecated in Platform API 0.12._ + For compatibility with older platforms and older buildpacks, base image authors SHOULD ensure for build images and run images: - The image config's `Env` field has the environment variable `CNB_STACK_ID` set to the stack ID. From a2d78bb626ad0051ff9c65244e190948f5119c1e Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 6 Jun 2023 11:00:16 -0400 Subject: [PATCH 36/46] Add more information in deprecations Also update table of contents Signed-off-by: Natalie Arellano --- platform.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/platform.md b/platform.md index 8266a20..0b69910 100644 --- a/platform.md +++ b/platform.md @@ -72,6 +72,7 @@ Examples of a platform might include: - [Buildpack Environment](#buildpack-environment) - [Base Image-Provided Variables](#base-image-provided-variables) - [User-Provided Variables](#user-provided-variables) + - [Operator-Defined Variables](#operator-defined-variables) - [Launch Environment](#launch-environment) - [Caching](#caching) - [Build Reproducibility](#build-reproducibility) @@ -89,6 +90,9 @@ Examples of a platform might include: - [`io.buildpacks.build.metadata` (JSON)](#iobuildpacksbuildmetadata-json) - [`io.buildpacks.lifecycle.metadata` (JSON)](#iobuildpackslifecyclemetadata-json) - [`io.buildpacks.project.metadata` (JSON)](#iobuildpacksprojectmetadata-json) + - [Deprecations](#deprecations) + - [`io.buildpacks.stack.*` Labels](#iobuildpacksstack-labels) + - [`io.buildpacks.lifecycle.metadata` (JSON) `stack` Key](#iobuildpackslifecyclemetadata-json-stack-key) ## Platform API Version @@ -125,6 +129,8 @@ The **launcher** refers to a lifecycle executable packaged in the **app image** An **image extension** refers to software compliant with the [Image Extension Interface Specification](image_extension.md). Image extensions participate in detection and execute before the buildpack build process. +A **stack** (deprecated, see [deprecations](#deprecations)) is a contract, implemented by a **build image** and **run image**, that guarantees properties of the **build environment** and **app image**. + #### Additional Terminology An **image reference** refers to either a **tag reference** or **digest reference**. @@ -143,7 +149,7 @@ The following is a non-exhaustive list of terms defined in the [OCI Distribution ### Build Image -A typical build image might specify: +A typical build image might determine: * The OS distro in the build environment. * OS packages installed in the build environment. * Trusted CA certificates in the build environment. @@ -166,7 +172,7 @@ The platform SHOULD ensure that: ### Run Image -A typical run image might specify: +A typical run image might determine: * The OS distro or distroless OS in the launch environment. * OS packages installed in the launch environment. * Trusted CA certificates in the launch environment. @@ -795,7 +801,7 @@ Usage: - **If** `` is `false` and more than one `` is provided, they MUST refer to the same registry - **If** `` is provided by the platform, the value will be used as the app image to rebase. `` must NOT be modified unless specified again in ``. - **Else** `` value will be derived from the first ``. -- **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `runImage` key in the `io.buildpacks.lifecycle.metdata` label on ``, or `stack.runImage` if not found (for compatibility with older platforms). +- **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `runImage` key in the `io.buildpacks.lifecycle.metdata` label on ``, or `stack.runImage` if not found (for compatibility with older platforms; see [deprecations](#deprecations)). - **If** `` is `true` the following values in the output `` config MUST be derived from the new ``, or else they MUST match the old run image if `` is `false`: - `os` - `architecture` @@ -1401,6 +1407,8 @@ For compatibility with older platforms and older buildpacks, base image authors - The image config's `Label` field has the label `io.buildpacks.stack.id` set to the stack ID. - The image config's `Label` field has the label `io.buildpacks.stack.mixins` set to a JSON array containing mixin names for each mixin applied to the image. +Where `CNB_STACK_ID` SHALL be directly inherited by buildpacks without modification. + To upgrade, the platform SHOULD upgrade all buildpacks to use Buildpack API `0.10` or greater. ### `io.buildpacks.lifecycle.metadata` (JSON) `stack` Key @@ -1418,4 +1426,6 @@ The `stack` key is deprecated. } ``` -To upgrade, the platform SHOULD read the same information from the `runImage` key. +Where `stack` MUST contain the same data as the top-level `runImage` key. + +To upgrade, the platform SHOULD read the same information from the top-level `runImage` key. From f2b87a29c1622cbf29e388975a602f92fdf6cf08 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 6 Jun 2023 11:03:32 -0400 Subject: [PATCH 37/46] Wording Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index 0b69910..696d00d 100644 --- a/platform.md +++ b/platform.md @@ -1428,4 +1428,4 @@ The `stack` key is deprecated. Where `stack` MUST contain the same data as the top-level `runImage` key. -To upgrade, the platform SHOULD read the same information from the top-level `runImage` key. +To upgrade, the platform SHOULD read the top-level `runImage` key instead. From 22ceb7f91029d80016428f79d85504987d893c84 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 13 Jun 2023 13:07:42 -0400 Subject: [PATCH 38/46] Apply suggestions from code review Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index 696d00d..162e9d0 100644 --- a/platform.md +++ b/platform.md @@ -185,7 +185,7 @@ The platform MUST ensure that: The platform SHOULD ensure that: - The image config's `User` field is set to a user with a **DIFFERENT** user [†](README.md#operating-system-conventions)UID/[‡](README.md#operating-system-conventions)SID as the build image. -- The image config's `Label` field has the label `io.buildpacks.id` set to the target ID (e.g., "minimal") of the image. +- The image config's `Label` field has the label `io.buildpacks.id` set to the target ID (e.g., "minimal") of the run image. - The image config's `Label` field has the label `io.buildpacks.base.maintainer` set to the name of the image maintainer. - The image config's `Label` field has the label `io.buildpacks.base.homepage` set to the homepage of the image. - The image config's `Label` field has the label `io.buildpacks.base.released` set to the release date of the image. From 2caf4d641315bf471a2aaab917ea7cd9896fae69 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 13 Jun 2023 13:10:43 -0400 Subject: [PATCH 39/46] Update labels to update during rebase Signed-off-by: Natalie Arellano --- platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.md b/platform.md index 162e9d0..7ebae5a 100644 --- a/platform.md +++ b/platform.md @@ -832,7 +832,7 @@ Usage: - The value of `io.buildpacks.lifecycle.metadata` SHALL be modified as follows - `run-image.reference` SHALL uniquely identify `` - `run-image.top-layer` SHALL be set to the uncompressed digest of the top layer in `` - - The value of `io.buildpacks.stack.*` labels SHALL be modified to that of the new `run-image` + - The value of `io.buildpacks.base.*` labels and `io.buildpacks.stack.*` labels (if present) SHALL be modified to that of the new `run-image` - **If** the provided `` is not found in `runImage.image` or `runImage.mirrors`: - `run-image.image` SHALL be the provided `` - `run-image.mirrors` SHALL be omitted From 5f0936c0034a25280edb80fccee567fbf98a49ee Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Wed, 5 Jul 2023 10:31:32 -0400 Subject: [PATCH 40/46] Rebaser: update -force cases Signed-off-by: Natalie Arellano --- platform.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/platform.md b/platform.md index 7ebae5a..b1245f4 100644 --- a/platform.md +++ b/platform.md @@ -802,12 +802,6 @@ Usage: - **If** `` is provided by the platform, the value will be used as the app image to rebase. `` must NOT be modified unless specified again in ``. - **Else** `` value will be derived from the first ``. - **If** `` is not provided by the platform, the value will be [resolved](#run-image-resolution) from the contents of the `runImage` key in the `io.buildpacks.lifecycle.metdata` label on ``, or `stack.runImage` if not found (for compatibility with older platforms; see [deprecations](#deprecations)). -- **If** `` is `true` the following values in the output `` config MUST be derived from the new ``, or else they MUST match the old run image if `` is `false`: - - `os` - - `architecture` - - `variant` (if specified) - - `io.buildpacks.distribution.name` (if specified) - - `io.buildpacks.distribution.version` (if specified) ##### Outputs | Output | Description @@ -833,9 +827,17 @@ Usage: - `run-image.reference` SHALL uniquely identify `` - `run-image.top-layer` SHALL be set to the uncompressed digest of the top layer in `` - The value of `io.buildpacks.base.*` labels and `io.buildpacks.stack.*` labels (if present) SHALL be modified to that of the new `run-image` -- **If** the provided `` is not found in `runImage.image` or `runImage.mirrors`: - - `run-image.image` SHALL be the provided `` - - `run-image.mirrors` SHALL be omitted +- **If** `` is `true`, the following [target data](#target-data) values in the output `` config MUST be derived from the new ``: + - `os` + - `architecture` + - `variant` (if specified) + - `io.buildpacks.distribution.name` (if specified) + - `io.buildpacks.distribution.version` (if specified) +- **Else** they MUST match the old run image if `` is `false` +- **If** `` is `true` and the provided `` is not found in `runImage.image` or `runImage.mirrors`: + - `run-image.image` SHALL be the provided `` + - `run-image.mirrors` SHALL be omitted +- **Else** the provided `` MUST be found in `runImage.image` or `runImage.mirrors` if `` is `false` - To ensure [build reproducibility](#build-reproducibility), the lifecycle: - SHOULD set the `created` time in image config to a constant From c6dd08c7ab7e7f920874429a14be3044b65ba3a0 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 6 Jul 2023 11:03:56 -0400 Subject: [PATCH 41/46] Clarify run image selection Signed-off-by: Natalie Arellano --- platform.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/platform.md b/platform.md index b1245f4..2f59c96 100644 --- a/platform.md +++ b/platform.md @@ -945,16 +945,15 @@ The launcher: ### Run Image Resolution -Given [run](#runtoml-toml) metadata, the `` for a given `` shall be resolved as follows: -- By choosing an image from `[[images]]` - - **If** the tag reference for the desired run image is known (e.g., from a `-run-image` flag or `analyzed.toml`): - - The first image in `[[images]]` where `image.image` or one of `image.mirrors` has a matching tag reference - - **Else** the first image in `[[images]]` -- By choosing the best mirror for an image - - **If** any of `image.image` or `image.mirrors` has a registry matching that of `` and is accessible with read permissions: +Given [run](#runtoml-toml) metadata shall be resolved as follows: +- By choosing the `` for a given ``: + - **If** any of `image.image` or `image.mirrors` has a registry matching that of `` and is accessible with read permissions: - This value will become the `` - - **If** none of `image.image` or `image.mirrors` has a registry matching that of ``: + - **If** none of `image.image` or `image.mirrors` has a registry matching that of ``: - The first value of `image.image` or `image.mirrors` that is accessible with read permissions will become the `` +- By choosing mirrors information for a given ``: + - The first image in `[[images]]` where `image.image` or one of `image.mirrors` matches `` + - **Else** the first image in `[[images]]` ### Registry Authentication @@ -1371,8 +1370,7 @@ Where: - The key MUST be the name of the layer - The value MUST contain JSON representation of the `layer.toml` with an additional `sha` key, containing the digest of the uncompressed layer - The value MUST contain an additional `sha` key, containing the digest of the uncompressed layer -- `runImage.image` MUST be a tag reference to the run-image -- `runImage.mirrors` MUST be selected from `run.toml` +- `runImage.image` and `runImage.mirrors` MUST be [resolved](#run-image-resolution) from `run.toml` from the given `` - `runImage.topLayer` MUST contain the uncompressed digest of the top layer of the run-image - `runImage.reference` MUST uniquely identify the run image. It MAY contain one of the following - An image ID (the digest of the uncompressed config blob) From aec9203a468dd2bda46544bb1743108d5e21dc95 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 24 Jul 2023 13:03:36 -0400 Subject: [PATCH 42/46] Apply suggestions from code review Co-authored-by: Terence Lee Signed-off-by: Natalie Arellano --- platform.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.md b/platform.md index 2f59c96..b88d0b0 100644 --- a/platform.md +++ b/platform.md @@ -833,11 +833,11 @@ Usage: - `variant` (if specified) - `io.buildpacks.distribution.name` (if specified) - `io.buildpacks.distribution.version` (if specified) -- **Else** they MUST match the old run image if `` is `false` +- **Else** the target data above MUST match the old run image if `` is `false` - **If** `` is `true` and the provided `` is not found in `runImage.image` or `runImage.mirrors`: - `run-image.image` SHALL be the provided `` - `run-image.mirrors` SHALL be omitted -- **Else** the provided `` MUST be found in `runImage.image` or `runImage.mirrors` if `` is `false` +- **Else if** ` is `false`, the provided `` MUST be found in `runImage.image` or `runImage.mirrors` - To ensure [build reproducibility](#build-reproducibility), the lifecycle: - SHOULD set the `created` time in image config to a constant From d6db12261e02a01fa100cee2a898e512dff305c9 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 28 Jul 2023 10:14:54 -0400 Subject: [PATCH 43/46] Apply suggestions from code review Signed-off-by: Natalie Arellano --- platform.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform.md b/platform.md index b88d0b0..286c76e 100644 --- a/platform.md +++ b/platform.md @@ -185,7 +185,7 @@ The platform MUST ensure that: The platform SHOULD ensure that: - The image config's `User` field is set to a user with a **DIFFERENT** user [†](README.md#operating-system-conventions)UID/[‡](README.md#operating-system-conventions)SID as the build image. -- The image config's `Label` field has the label `io.buildpacks.id` set to the target ID (e.g., "minimal") of the run image. +- The image config's `Label` field has the label `io.buildpacks.base.id` set to the target ID (e.g., "minimal") of the run image. - The image config's `Label` field has the label `io.buildpacks.base.maintainer` set to the name of the image maintainer. - The image config's `Label` field has the label `io.buildpacks.base.homepage` set to the homepage of the image. - The image config's `Label` field has the label `io.buildpacks.base.released` set to the release date of the image. @@ -197,14 +197,14 @@ The platform SHOULD ensure that: For both build images and run images, the platform MUST ensure that: - The image config's `os` and `architecture` fields are set to valid identifiers as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). -- The build image config and the run image config both specify the same `os`, `architecture`, `variant` (if specified), `io.buildpacks.distribution.name` (if specified), and `io.buildpacks.distribution.version` (if specified). +- The build image config and the run image config both specify the same `os`, `architecture`, `variant` (if specified), `io.buildpacks.base.distro.name` (if specified), and `io.buildpacks.base.distro.version` (if specified). The platform SHOULD ensure that: - The image config's `variant` field is set to a valid identifier as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md). -- The image config's `Label` field has the label `io.buildpacks.distribution.name` set to the OS distribution and the label `io.buildpacks.distribution.version` set to the OS distribution version. +- The image config's `Label` field has the label `io.buildpacks.base.distro.name` set to the OS distribution and the label `io.buildpacks.base.distro.version` set to the OS distribution version. - For Linux-based images, each label should contain the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`), as the `os.version` field in an image config may contain combined distribution and version information. - - For Windows-based images, `io.buildpacks.distribution.name` should be empty; `io.buildpacks.distribution.version` should contain the value of `os.version` in the image config (e.g., `10.0.14393.1066`). + - For Windows-based images, `io.buildpacks.base.distro.name` should be empty; `io.buildpacks.base.distro.version` should contain the value of `os.version` in the image config (e.g., `10.0.14393.1066`). ### Compatibility Guarantees From ea0bcde72fb459e4033ee47c0a29d61a05a90226 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 28 Jul 2023 10:16:54 -0400 Subject: [PATCH 44/46] Update more label names Signed-off-by: Natalie Arellano --- platform.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform.md b/platform.md index 286c76e..447514d 100644 --- a/platform.md +++ b/platform.md @@ -831,8 +831,8 @@ Usage: - `os` - `architecture` - `variant` (if specified) - - `io.buildpacks.distribution.name` (if specified) - - `io.buildpacks.distribution.version` (if specified) + - `io.buildpacks.base.distro.name` (if specified) + - `io.buildpacks.base.distro.version` (if specified) - **Else** the target data above MUST match the old run image if `` is `false` - **If** `` is `true` and the provided `` is not found in `runImage.image` or `runImage.mirrors`: - `run-image.image` SHALL be the provided `` @@ -1113,7 +1113,7 @@ Where: - `image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon - `image.metadata` MUST be the TOML representation of the layer [metadata label](#iobuildpackslifecyclemetadata-json) - `run-image.reference` MUST be either a digest reference to an image in an OCI registry or the ID of an image in a docker daemon -- `run-image.target.id` is optional and MUST be the value of the label `io.buildpacks.id` +- `run-image.target.id` is optional and MUST be the value of the label `io.buildpacks.base.id` - `run-image.target` contains the [target data](#target-data) for the image - If target distribution data is missing, it will be inferred from `/etc/os-release` for Linux images; furthermore, if the image contains the label `io.buildpacks.stack.id` with value `io.buildpacks.stacks.bionic`, the lifecycle SHALL assume the following values: - `run-image.target.os = "linux"` From 4f4aa24be5a141ede8540c84bf21e33a251d8c1d Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 28 Jul 2023 10:20:22 -0400 Subject: [PATCH 45/46] Update definition Signed-off-by: Natalie Arellano --- platform.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.md b/platform.md index 447514d..04c6c63 100644 --- a/platform.md +++ b/platform.md @@ -109,9 +109,9 @@ A **buildpack** refers to software compliant with the [Buildpack Interface Speci A **base image** is an OCI image containing the base, or initial set of layers, for other images. -A **build image** is an OCI image that provides the base of the **build environment**. +A **build image** is an OCI image that serves as the base image for the **build environment**. -A **run image** is an OCI image that provides the base from which **app images** are built. +A **run image** is an OCI image that serves as the base image for the **app image**. The **build environment** refers to the containerized environment in which the lifecycle executes buildpacks. From bc1e7535a84ce5e7017555e6b5e55103813d8002 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 31 Jul 2023 10:03:03 -0400 Subject: [PATCH 46/46] Add further guidance about target ID Signed-off-by: Natalie Arellano --- platform.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/platform.md b/platform.md index 04c6c63..8b79f27 100644 --- a/platform.md +++ b/platform.md @@ -185,7 +185,6 @@ The platform MUST ensure that: The platform SHOULD ensure that: - The image config's `User` field is set to a user with a **DIFFERENT** user [†](README.md#operating-system-conventions)UID/[‡](README.md#operating-system-conventions)SID as the build image. -- The image config's `Label` field has the label `io.buildpacks.base.id` set to the target ID (e.g., "minimal") of the run image. - The image config's `Label` field has the label `io.buildpacks.base.maintainer` set to the name of the image maintainer. - The image config's `Label` field has the label `io.buildpacks.base.homepage` set to the homepage of the image. - The image config's `Label` field has the label `io.buildpacks.base.released` set to the release date of the image. @@ -194,6 +193,15 @@ The platform SHOULD ensure that: ### Target Data +For run images, the platform SHOULD ensure that: + +- The image config's `Label` field has the label `io.buildpacks.base.id` set to the target ID of the run image. + +**The target ID:** +- MUST only contain numbers, letters, and the characters `.`, `/`, and `-`. +- MUST NOT be identical to any other target ID when using a case-insensitive comparison. +- SHOULD use reverse domain notation to avoid name collisions - i.e. buildpacks.io will be `io.buildpacks`. + For both build images and run images, the platform MUST ensure that: - The image config's `os` and `architecture` fields are set to valid identifiers as defined in the [OCI Image Specification](https://github.com/opencontainers/image-spec/blob/main/config.md).