Skip to content

[Buildpack API] - Add Execution Enviroment definition #415

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jjbustamante
Copy link
Member

@jjbustamante jjbustamante commented May 7, 2025

RFC-0134

  1. Added Execution Environments concept:
    - Added a dedicated "Execution Environments" section explaining the concept
    - Defined standard values: production (default), test, and development
    - Described how buildpacks should adapt behavior based on these environments
  2. Environment variables:
    - Added CNB_EXEC_ENV to both the detect and build phase inputs
    - Documented that when not set, it defaults to "production"
  3. Configuration formats:
    - Updated buildpack.toml to include exec-env in the targets section
    - Updated launch.toml processes to include execution environment restrictions
    - Updated Layer Content Metadata to support execution environment in metadata
  4. Implementation guidance:
    - Added recommendations for how buildpacks should handle different environments
    - Specified how layers and processes can be targeted to specific environments
    - Clarified that buildpacks must assume "production" when no environment is specified
  5. Technical specifications:
    - Detailed how buildpacks can mark processes for specific execution environments
    - Explained that layers can be environment-specific
    - Provided guidance on optimizing build strategies per environment

These changes enable buildpacks to create different outputs depending on whether the application will be used in production, testing, or development contexts.

Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
@jjbustamante jjbustamante marked this pull request as ready for review May 7, 2025 02:11
@jjbustamante jjbustamante requested a review from a team as a code owner May 7, 2025 02:11
@jjbustamante jjbustamante added this to the Buildpack 0.12 milestone May 7, 2025
Copy link
Member

@natalieparellano natalieparellano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. This should be repointed at buildpack/0.12

@@ -1021,7 +1044,8 @@ name = "<dependency name>"
cache = false

[metadata]
# buildpack-specific data
exec-env = ["<execution environment>"] # Optional. If not specified, applies to all execution environments
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify on the platform side - if the previous image was built with a different value of exec-env do we do anything? Looking at the platform PR, it seems not. So do we expect buildpacks to inspect this value and re-create the layer if needed? If so we might want to call this out somewhere.

### Execution Environments

Execution environments define the context in which a buildpack-created application is intended to run. Standard values include:
- `production`: The default environment, optimized for running applications in production.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this in conflict with this part from the RFC? https://github.com/buildpacks/rfcs/pull/274/files#diff-5e1fecc151d09b271a5fd5407df8a4b069753c4b34b6687f5e1e7c2a29da7f33R71

Namely

An individual element can be any string with * having special meaning. Similar to the "any stack RFC", * will apply to all execution environments. ["*"] will be the default if not specified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add

In addition, the / character is reserved in case we need to introduce namespacing in the future.

Copy link
Member

@natalieparellano natalieparellano May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's ambiguity around how this should work, I suggest we follow the same pattern as "targets", where missing means "any".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, i think reserving the / now is a good idea.

i think we agreed in the rfc that default should be production, not *

@natalieparellano natalieparellano self-requested a review May 9, 2025 15:15
…Specifically:

  1. Added clarification about platform behavior when the execution environment differs between builds
  2. Added a note prohibiting the / character in execution environment values as it's reserved

Signed-off-by: Juan Bustamante <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants