You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: platform.md
+27-3Lines changed: 27 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -131,6 +131,8 @@ A **launcher layer** refers to a layer in the app OCI image containing the **lau
131
131
132
132
The **launcher** refers to a lifecycle executable packaged in the **app image** for the purpose of executing processes at runtime.
133
133
134
+
An **execution environment** refers to the context in which an application is intended to run. Standard values include "production", "test", and "development". Production is the default if not specified. The value MUST NOT contain the character `/` as it is reserved for future use.
135
+
134
136
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.
135
137
136
138
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**.
@@ -402,6 +404,7 @@ Usage:
402
404
|`<app>`|`CNB_APP_DIR`|`/workspace`| Path to application directory |
403
405
|`<build-config>`|`CNB_BUILD_CONFIG_DIR`|`/cnb/build-config`| Path to build config directory |
404
406
|`<buildpacks>`|`CNB_BUILDPACKS_DIR`|`/cnb/buildpacks`| Path to buildpacks directory (see [Buildpacks Directory Layout](#buildpacks-directory-layout)) |
407
+
|`<exec-env>`|`CNB_EXEC_ENV`|`production`| Target execution environment. Standard values: "production", "test", "development". |
405
408
|`<extensions>`^ |`CNB_EXTENSIONS_DIR`|`/cnb/extensions`| Path to image extensions directory (see [Image Extensions Directory Layout](#image-extensions-directory-layout)|
406
409
|`<generated>`^ |`CNB_GENERATED_DIR`|`<layers>/generated`| Path to output directory for generated Dockerfiles |
407
410
|`<group>`|`CNB_GROUP_PATH`|`<layers>/group.toml`| Path to output group definition |
@@ -451,6 +454,10 @@ The lifecycle:
451
454
- SHALL detect a single group from `<order>` and write it to `<group>` using the [detection process](buildpack.md#phase-1-detection) outlined in the Buildpack Interface Specification
452
455
- SHALL write the resolved build plan from the detected group to `<plan>`
453
456
- SHALL provide `run-image.target` data in `<analyzed>` to buildpacks according to the process outlined in the [Buildpack Interface Specification](buildpack.md).
457
+
- When `CNB_EXEC_ENV` is set to a value other than the default:
458
+
- The lifecycle SHALL skip buildpacks that do not support the current execution environment during detection
459
+
- If all buildpacks in a group are skipped due to execution environment mismatch, the lifecycle SHALL continue to the next group in the order
460
+
- This allows the platform to select buildpack groups appropriate for the target execution environment
454
461
455
462
When image extensions are present in the order (optional), the lifecycle:
456
463
- SHALL execute all image extensions in the order defined in `<group>` according to the process outlined in the [Buildpack Interface Specification](buildpack.md).
@@ -510,6 +517,7 @@ Usage:
510
517
|`<skip-layers>`|`CNB_SKIP_LAYERS`|`false`| Do not perform [layer restoration](#layer-restoration)|
511
518
|`<uid>`|`CNB_USER_ID`|| UID of the build image `User`|
512
519
|`<run>`**|`CNB_RUN_PATH`|`/cnb/run.toml`| Path to run file (see [`run.toml`](#runtoml-toml)) |
520
+
|`<exec-env>`|`CNB_EXEC_ENV`|`production`| Target execution environment. Standard values: "production", "test", "development". |
513
521
> ^ Only needed when using image extensions
514
522
515
523
> \* Only needed when using image extensions to extend the build image
@@ -552,7 +560,9 @@ Usage:
552
560
553
561
##### Layer Restoration
554
562
555
-
lifeycle MUST use the provided `cache-dir` or `cache-image` to retrieve cache contents. The [rules](https://github.com/buildpacks/spec/blob/main/buildpack.md#layer-types) for restoration MUST be followed when determining how and when to store cache layers.
563
+
The lifecycle MUST use the provided `cache-dir` or `cache-image` to retrieve cache contents. The [rules](https://github.com/buildpacks/spec/blob/main/buildpack.md#layer-types) for restoration MUST be followed when determining how and when to store cache layers.
564
+
565
+
When a platform builds an application with a different execution environment than was used in a previous build (different value of `CNB_EXEC_ENV`), the platform SHOULD NOT restore layers from the previous build's image. The lifecycle MAY ignore layer metadata from previous builds with different execution environments to ensure proper environment-specific behaviors are maintained.
556
566
557
567
#### `extender` (optional)
558
568
@@ -597,6 +607,7 @@ Usage:
597
607
|`<plan>`*|`CNB_PLAN_PATH`|`<layers>/plan.toml`| Path to resolved build plan (see [`plan.toml`](#plantoml-toml)) |
598
608
|`<platform>`|`CNB_PLATFORM_DIR`|`/platform`| Path to platform directory |
599
609
|`<uid>`*|`CNB_USER_ID`|| UID of the build image `User`|
610
+
|`<exec-env>`|`CNB_EXEC_ENV`|`production`| Target execution environment. Standard values: "production", "test", "development". |
600
611
601
612
> \* Only needed when extending the build image
602
613
@@ -665,6 +676,7 @@ Usage:
665
676
|`<app>`|`CNB_APP_DIR`|`/workspace`| Path to application directory |
666
677
|`<build-config>`|`CNB_BUILD_CONFIG_DIR`|`/cnb/build-config`| Path to build config directory |
667
678
|`<buildpacks>`|`CNB_BUILDPACKS_DIR`|`/cnb/buildpacks`| Path to buildpacks directory (see [Buildpacks Directory Layout](#buildpacks-directory-layout)) |
679
+
|`<exec-env>`|`CNB_EXEC_ENV`|`production`| Target execution environment. Standard values: "production", "test", "development". |
668
680
|`<group>`|`CNB_GROUP_PATH`|`<layers>/group.toml`| Path to group definition (see [`group.toml`](#grouptoml-toml)) |
669
681
|`<layers>`|`CNB_LAYERS_DIR`|`/layers`| Path to layers directory |
|`<app>`|`CNB_APP_DIR`|`/workspace`| Path to application directory |
1012
+
|`<exec-env>`|`CNB_EXEC_ENV`|`production`| Target execution environment. Standard values: "production", "test", "development". |
1000
1013
|`<layers>`|`CNB_LAYERS_DIR`|`/layers`| Path to layer directory |
1001
1014
|`<process-type>`|||`type` of process to launch |
1002
1015
|`<direct>`||| Process execution strategy |
@@ -1013,7 +1026,12 @@ The launcher:
1013
1026
-**If** the final path element in `$0`, matches the type of any buildpack-provided process type
1014
1027
-`<process-type>` SHALL be the final path element in `$0`
1015
1028
- The lifecycle:
1016
-
- MUST select the process with type equal to `<process-type>` from `<layers>/config/metadata.toml`
1029
+
- MUST select the process with type equal to `<process-type>` from `<layers>/config/metadata.toml` that is eligible for the current execution environment
1030
+
-**If** no process with the requested type is eligible for the current execution environment, the lifecycle MUST fail
1031
+
- A process is considered eligible for the current execution environment if:
1032
+
- It has no execution environment specified in `exec-env`, OR
1033
+
- Its `exec-env` includes the value of `<exec-env>`, OR
1034
+
- Its `exec-env` includes the special value `"*"` which indicates compatibility with all execution environments
1017
1035
- MUST set `<working-dir>` to the value defined for the process in `<layers>/config/metadata.toml`, or to `<app>` if not defined
1018
1036
-**If** the buildpack that provided the process supports default process args
1019
1037
-`<direct>` SHALL be `true`
@@ -1337,6 +1355,7 @@ command = ["<command>"]
1337
1355
args = ["<arguments>"]
1338
1356
direct = false
1339
1357
working-dir = "<working directory>"
1358
+
exec-env = ["<execution environment>"] # Optional. If not specified, applies to all execution environments. The special value "*" indicates compatibility with all execution environments. If exec-env is ["*"] or not specified, the process is eligible for all execution environments.
-`id`, `version`, and `api` MUST be present for each buildpack
1347
1366
-`processes` contains the complete set of processes contributed by all buildpacks
1367
+
- The `exec-env` field MUST be set to `["*"]` if the process applies to all execution environments
1368
+
- The `exec-env` field MUST contain specific execution environment values (e.g., `["production"]`, `["test", "development"]`) if the process is restricted to certain environments
1369
+
- If `exec-env` is not specified, it SHALL be treated as `["*"]` (applies to all environments)
1348
1370
-`slices` contains the complete set of slices defined by all buildpacks
1349
1371
1350
1372
#### `order.toml` (TOML)
@@ -1478,7 +1500,8 @@ Where:
1478
1500
],
1479
1501
"direct":false,
1480
1502
"working-dir":"<working-dir>",
1481
-
"buildpackID":"<buildpack ID>"
1503
+
"buildpackID":"<buildpack ID>",
1504
+
"exec-env": ["<execution environment>"] // Array of execution environments. Use ["*"] for all environments. If omitted, defaults to ["*"]
0 commit comments