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: buildpack.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -818,9 +818,9 @@ The following additional environment variables MUST NOT be overridden by the lif
818
818
|`HOME`| Current user's home directory |[x]|[x]|[x]|
819
819
820
820
During the detection and build phases, the lifecycle MUST provide as environment variables any user-provided files in `<platform>/env/` with environment variable names and contents matching the file names and contents.
821
-
During the detection and build phases, the lifecycle MUST provide as environment variables any operator-provided files in `<build-config>/env` with environment variable names and contents matching the file names and contents. This applies for all values of `clear-env` or if `clear-env` is undefined in `buildpack.toml`.
821
+
During the detection and build phases, the lifecycle MUST provide as environment variables any operator-provided files in `<platform>/env` with environment variable names and contents matching the file names and contents. This applies for all values of `clear-env` or if `clear-env` is undefined in `buildpack.toml`.
822
822
823
-
When `clear-env` in `buildpack.toml` is set to `true` for a given buildpack, the lifecycle MUST NOT set user-provided environment variables in the environment of `/bin/detect` or `/bin/build`.
823
+
When `clear-env` in `buildpack.toml` is set to `true` for a given buildpack, the lifecycle MUST NOT set user-provided environment variables in the environment of `/bin/detect` or `/bin/build`. The user-provided files in `<platform>/env/` contents will still be available.
824
824
825
825
When `clear-env` in `buildpack.toml` is not set to `true` for a given buildpack, the lifecycle MUST set user-provided environment variables in the environment of `/bin/detect` or `/bin/build` such that:
826
826
1. For layer path environment variables, user-provided values are prepended before any existing values and are delimited by the OS path list separator.
@@ -130,6 +131,8 @@ A **launcher layer** refers to a layer in the app OCI image containing the **lau
130
131
131
132
The **launcher** refers to a lifecycle executable packaged in the **app image** for the purpose of executing processes at runtime.
132
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
+
133
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.
134
137
135
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**.
@@ -389,7 +392,8 @@ Usage:
389
392
[-order <order>] \
390
393
[-plan <plan>] \
391
394
[-platform <platform>] \
392
-
[-run <run> ]
395
+
[-run <run> ] \
396
+
[-system <system>]
393
397
```
394
398
395
399
##### Inputs
@@ -400,6 +404,7 @@ Usage:
400
404
|`<app>`|`CNB_APP_DIR`|`/workspace`| Path to application directory |
401
405
|`<build-config>`|`CNB_BUILD_CONFIG_DIR`|`/cnb/build-config`| Path to build config directory |
402
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". |
403
408
|`<extensions>`^ |`CNB_EXTENSIONS_DIR`|`/cnb/extensions`| Path to image extensions directory (see [Image Extensions Directory Layout](#image-extensions-directory-layout)|
404
409
|`<generated>`^ |`CNB_GENERATED_DIR`|`<layers>/generated`| Path to output directory for generated Dockerfiles |
405
410
|`<group>`|`CNB_GROUP_PATH`|`<layers>/group.toml`| Path to output group definition |
@@ -409,6 +414,7 @@ Usage:
409
414
|`<plan>`|`CNB_PLAN_PATH`|`<layers>/plan.toml`| Path to output resolved build plan |
410
415
|`<platform>`|`CNB_PLATFORM_DIR`|`/platform`| Path to platform directory |
411
416
|`<run>`^ |`CNB_RUN_PATH`|`/cnb/run.toml`| Path to run file (see [`run.toml`](#runtoml-toml)) |
417
+
|`<system>`|`CNB_SYSTEM_PATH`|`/cnb/system.toml`| Path to system buildpacks file (see [`system.toml`](#systemtoml-toml)) |
412
418
413
419
> ^Only needed when using image extensions
414
420
@@ -438,10 +444,20 @@ Usage:
438
444
|`91`| Extension generate error |
439
445
|`92-99`| Generation-specific lifecycle errors |
440
446
447
+
When `<system>` is provided (optional), the lifecycle:
448
+
- SHALL merge the `system.pre.buildpacks` group with each group from `<order>` such that the `pre` buildpacks are placed at the beginning of each order group before running detection.
449
+
- System buildpacks in `pre` SHALL NOT be merged if the group already contains a buildpack with the same ID.
450
+
- SHALL merge the `system.post.buildpacks` group with each group from `<order>` such that the `post` buildpacks are placed at the end of each order group before running detection.
451
+
- System buildpacks in `post` SHALL NOT be merged if the group already contains a buildpack with the same ID.
452
+
441
453
The lifecycle:
442
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
443
455
- SHALL write the resolved build plan from the detected group to `<plan>`
444
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
445
461
446
462
When image extensions are present in the order (optional), the lifecycle:
447
463
- SHALL execute all image extensions in the order defined in `<group>` according to the process outlined in the [Buildpack Interface Specification](buildpack.md).
@@ -501,6 +517,7 @@ Usage:
501
517
|`<skip-layers>`|`CNB_SKIP_LAYERS`|`false`| Do not perform [layer restoration](#layer-restoration)|
502
518
|`<uid>`|`CNB_USER_ID`|| UID of the build image `User`|
503
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". |
504
521
> ^ Only needed when using image extensions
505
522
506
523
> \* Only needed when using image extensions to extend the build image
@@ -543,7 +560,9 @@ Usage:
543
560
544
561
##### Layer Restoration
545
562
546
-
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.
547
566
548
567
#### `extender` (optional)
549
568
@@ -588,6 +607,7 @@ Usage:
588
607
|`<plan>`*|`CNB_PLAN_PATH`|`<layers>/plan.toml`| Path to resolved build plan (see [`plan.toml`](#plantoml-toml)) |
589
608
|`<platform>`|`CNB_PLATFORM_DIR`|`/platform`| Path to platform directory |
590
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". |
591
611
592
612
> \* Only needed when extending the build image
593
613
@@ -656,6 +676,7 @@ Usage:
656
676
|`<app>`|`CNB_APP_DIR`|`/workspace`| Path to application directory |
657
677
|`<build-config>`|`CNB_BUILD_CONFIG_DIR`|`/cnb/build-config`| Path to build config directory |
658
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". |
659
680
|`<group>`|`CNB_GROUP_PATH`|`<layers>/group.toml`| Path to group definition (see [`group.toml`](#grouptoml-toml)) |
660
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". |
991
1013
|`<layers>`|`CNB_LAYERS_DIR`|`/layers`| Path to layer directory |
992
1014
|`<process-type>`|||`type` of process to launch |
993
1015
|`<direct>`||| Process execution strategy |
@@ -1004,7 +1026,12 @@ The launcher:
1004
1026
-**If** the final path element in `$0`, matches the type of any buildpack-provided process type
1005
1027
-`<process-type>` SHALL be the final path element in `$0`
1006
1028
- The lifecycle:
1007
-
- 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
1008
1035
- MUST set `<working-dir>` to the value defined for the process in `<layers>/config/metadata.toml`, or to `<app>` if not defined
1009
1036
-**If** the buildpack that provided the process supports default process args
1010
1037
-`<direct>` SHALL be `true`
@@ -1328,6 +1355,7 @@ command = ["<command>"]
1328
1355
args = ["<arguments>"]
1329
1356
direct = false
1330
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
1338
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)
1339
1370
-`slices` contains the complete set of slices defined by all buildpacks
1340
1371
1341
1372
#### `order.toml` (TOML)
@@ -1433,6 +1464,27 @@ Where:
1433
1464
- SHOULD reference an image with ID identical to that of `image.image`
1434
1465
-`image.image` and `image.mirrors.[]` SHOULD each refer to a unique registry
1435
1466
1467
+
#### `system.toml` (TOML)
1468
+
1469
+
```toml
1470
+
[[system.pre.buildpacks]]
1471
+
id = "<buildpack ID>"
1472
+
version = "<buildpack version>"
1473
+
optional = false
1474
+
1475
+
[[system.post.buildpacks]]
1476
+
id = "<buildpack ID>"
1477
+
version = "<buildpack version>"
1478
+
optional = false
1479
+
```
1480
+
1481
+
Where:
1482
+
1483
+
-`system.pre.buildpacks` MAY contain a list of buildpacks to insert at the beginning of every order group before detection.
1484
+
-`system.post.buildpacks` MAY contain a list of buildpacks to insert at the end of every order group before detection.
1485
+
- Both `id` and `version` MUST be present for each buildpack object in `system.pre.buildpacks` and `system.post.buildpacks`.
1486
+
- The value of `optional` MUST default to `false` if not specified.
1487
+
1436
1488
### Labels
1437
1489
1438
1490
#### `io.buildpacks.build.metadata` (JSON)
@@ -1448,7 +1500,8 @@ Where:
1448
1500
],
1449
1501
"direct":false,
1450
1502
"working-dir":"<working-dir>",
1451
-
"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