-
Notifications
You must be signed in to change notification settings - Fork 72
[Platform API] - Add Execution Environment definition #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c8dda27
Add Execution Environment
jjbustamante cf2a199
formatting issue
jjbustamante 0312eab
Fixing review comments from Natalie
jjbustamante cfcd6ba
1. ✅ Added CNB_EXEC_ENV to the restorer phase - The environment vari…
jjbustamante 29d89c0
Merge branch 'main' into jjbustamante/0134-execution-env-platform
jkutner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,6 +130,8 @@ 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 **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. | ||
|
|
||
| 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**. | ||
|
|
@@ -400,6 +402,7 @@ Usage: | |
| | `<app>` | `CNB_APP_DIR` | `/workspace` | Path to application directory | | ||
| | `<build-config>` | `CNB_BUILD_CONFIG_DIR` | `/cnb/build-config` | Path to build config directory | | ||
| | `<buildpacks>` | `CNB_BUILDPACKS_DIR` | `/cnb/buildpacks` | Path to buildpacks directory (see [Buildpacks Directory Layout](#buildpacks-directory-layout)) | | ||
| | `<exec-env>` | `CNB_EXEC_ENV` | `production` | Target execution environment. Standard values: "production", "test", "development". | | ||
| | `<extensions>`^ | `CNB_EXTENSIONS_DIR` | `/cnb/extensions` | Path to image extensions directory (see [Image Extensions Directory Layout](#image-extensions-directory-layout) | | ||
| | `<generated>`^ | `CNB_GENERATED_DIR` | `<layers>/generated` | Path to output directory for generated Dockerfiles | | ||
| | `<group>` | `CNB_GROUP_PATH` | `<layers>/group.toml` | Path to output group definition | | ||
|
|
@@ -656,6 +659,7 @@ Usage: | |
| | `<app>` | `CNB_APP_DIR` | `/workspace` | Path to application directory | | ||
| | `<build-config>` | `CNB_BUILD_CONFIG_DIR` | `/cnb/build-config` | Path to build config directory | | ||
| | `<buildpacks>` | `CNB_BUILDPACKS_DIR` | `/cnb/buildpacks` | Path to buildpacks directory (see [Buildpacks Directory Layout](#buildpacks-directory-layout)) | | ||
| | `<exec-env>` | `CNB_EXEC_ENV` | `production` | Target execution environment. Standard values: "production", "test", "development". | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably want
|
||
| | `<group>` | `CNB_GROUP_PATH` | `<layers>/group.toml` | Path to group definition (see [`group.toml`](#grouptoml-toml)) | | ||
| | `<layers>` | `CNB_LAYERS_DIR` | `/layers` | Path to layers directory | | ||
| | `<log-level>` | `CNB_LOG_LEVEL` | `info` | Log Level | | ||
|
|
@@ -988,6 +992,7 @@ Usage: | |
| | Input | Environment Variable | Default Value | Description | | ||
| |------------------------------------|----------------------|---------------|-----------------------------------------------------------| | ||
| | `<app>` | `CNB_APP_DIR` | `/workspace` | Path to application directory | | ||
| | `<exec-env>` | `CNB_EXEC_ENV` | `production` | Target execution environment. Standard values: "production", "test", "development". | | ||
| | `<layers>` | `CNB_LAYERS_DIR` | `/layers` | Path to layer directory | | ||
| | `<process-type>` | | | `type` of process to launch | | ||
| | `<direct>` | | | Process execution strategy | | ||
|
|
@@ -1004,7 +1009,11 @@ The launcher: | |
| - **If** the final path element in `$0`, matches the type of any buildpack-provided process type | ||
| - `<process-type>` SHALL be the final path element in `$0` | ||
| - The lifecycle: | ||
| - MUST select the process with type equal to `<process-type>` from `<layers>/config/metadata.toml` | ||
| - MUST select the process with type equal to `<process-type>` from `<layers>/config/metadata.toml` that is eligible for the current execution environment | ||
| - **If** no process with the requested type is eligible for the current execution environment, the lifecycle MUST fail | ||
| - A process is considered eligible for the current execution environment if: | ||
| - It has no execution environment specified in `exec-env`, OR | ||
| - Its `exec-env` includes the value of `<exec-env>` | ||
| - MUST set `<working-dir>` to the value defined for the process in `<layers>/config/metadata.toml`, or to `<app>` if not defined | ||
| - **If** the buildpack that provided the process supports default process args | ||
| - `<direct>` SHALL be `true` | ||
|
|
@@ -1328,6 +1337,7 @@ command = ["<command>"] | |
| args = ["<arguments>"] | ||
| direct = false | ||
| working-dir = "<working directory>" | ||
| exec-env = ["<execution environment>"] # Optional. If not specified, applies to all execution environments | ||
|
|
||
| [[slices]] | ||
| paths = ["<app sub-path glob>"] | ||
|
|
@@ -1448,7 +1458,8 @@ Where: | |
| ], | ||
| "direct": false, | ||
| "working-dir": "<working-dir>", | ||
| "buildpackID": "<buildpack ID>" | ||
| "buildpackID": "<buildpack ID>", | ||
| "exec-env": ["<execution environment>"] // Optional. If not specified, applies to all execution environments | ||
| } | ||
| ], | ||
| "buildpacks": [ | ||
|
|
@@ -1498,6 +1509,7 @@ Where: | |
| "config": { | ||
| "sha": "<config-layer-diffID>" | ||
| }, | ||
| "exec-env": "<execution environment>", | ||
| "launcher": { | ||
| "sha": "<launcher-layer-diffID>" | ||
| }, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all seems fine to me, but I'm looking at this comment from the RFC and I don't see that specified anywhere. Are we expecting the lifecycle to skip over buildpacks or groups that don't match the current environment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. the question is if we want to skip an entire group if one of the buildpack doesn't match the env. We need @hone to chime in there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkutner @hone @natalieparellano here is a proposal
Or do we want to skip the entire group?