-
Notifications
You must be signed in to change notification settings - Fork 314
Proof of Concept for Execution Environment RFC #2324
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
Draft
jjbustamante
wants to merge
19
commits into
main
Choose a base branch
from
jjbustamante/execution-environment-poc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+554
−24
Conversation
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
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2324 +/- ##
==========================================
- Coverage 60.76% 60.64% -0.12%
==========================================
Files 254 255 +1
Lines 19165 19228 +63
==========================================
+ Hits 11643 11658 +15
- Misses 6712 6759 +47
- Partials 810 811 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
…in progress Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
This was referenced Jun 16, 2025
|
For anyone else following along with this work - there is now a tracking issue for implementing the RFC at: |
Resolved conflicts by keeping both features: - ExecutionEnv/CNBExecutionEnv from execution-environment-poc branch - InsecureRegistries from main branch Files with resolved conflicts: - internal/commands/build.go - internal/commands/build_test.go - pkg/client/build.go
Changes Made:
1. internal/build/lifecycle_executor.go (2 lines added)
- Added Platform API versions 0.14 and 0.15 to SupportedPlatformAPIVersions
- This allows pack to support the new execution environment feature which requires Platform API 0.15
2. internal/build/phase_config_provider.go (1 line changed)
- Updated the Platform API version check from 0.13 to 0.15 for the CNB_EXEC_ENV environment variable
3. internal/build/fakes/fake_builder.go (7 lines added)
- Added WithExecutionEnvironment() helper function for tests
- Allows tests to easily set the execution environment in lifecycle options
4. internal/build/phase_config_provider_test.go (41 lines added)
- Added comprehensive tests for the execution environment feature:
- ✅ Test that CNB_EXEC_ENV is set when Platform API >= 0.15
- ✅ Test that CNB_EXEC_ENV is NOT set when Platform API < 0.15
- Added import for "github.com/buildpacks/lifecycle/api" package
Existing Test Coverage (Already in PR):
1. internal/commands/build_test.go
- ✅ Tests that default exec-env is 'production'
- ✅ Tests with valid characters (letters, numbers, dots, hyphens)
- ✅ Tests with invalid characters (shows proper error)
- ✅ Comprehensive validation tests for exec-env flag
2. builder/config_reader_test.go
- ✅ Tests reading exec-env from builder configuration
3. pkg/project/project_test.go
- ✅ Tests reading exec-env from project.toml (schema v0.3)
- ✅ Tests for buildpack groups, pre-groups, and post-groups
Test Results:
- All phase config provider tests: PASSING ✅
- All build command tests: PASSING ✅
- Coverage for exec-env flag validation: COMPLETE ✅
- Coverage for CNB_EXEC_ENV environment variable: COMPLETE ✅
- Coverage for Platform API version gating: COMPLETE ✅
The test coverage for your ExecutionEnvironment feature is now comprehensive and covers:
- Command-line flag validation
- Environment variable setting based on Platform API version
- Builder and project configuration reading
- Edge cases and error conditions
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR is intended to be an initial implementation of the Execution Environment RFC. it uses an initial implementation on lifecycle developed by @jabrown85 in the following branch
The RFC is in a voting state; we must include those changes in some API version and the current code should be updated afterward.
Changes added
pack buildcommand was added,--exec-env, to pass through the execution environment during the build process. By default, the value will be productionOutput
Before
The Execution Environment feature doesn't exist, nothing to show here.
After
I added a bunch of unit tests to the updated toml files, but to test all together I used our sample repo. The hello-moon buildpack prints some environment variables during its execution.
Using a current lifecycle.
packwith the changes made in this PR--exec-envflagNotice in the following log how
packis sending theCNB_EXEC_ENVenvironment variable with the value we set in the--exec-envflag to thelifecycleAlso notice, because this
lifecycleversion doesn't know anything about theCNB_EXEC_ENVwhen our hello-moon buildpacks runs, we don't see the environment variable there.Using a lifecycle compiled from Jesse's branch
As I mentioned before, @jabrown85 created a lifecycle implementation for this RFC, I compiled a
lifecyclefrom that branch and created a sample builder with it. I built the sample ruby application using that builder.Similar to our previous example,
packsends theCNB_EXEC_ENVwith the value we specified in the command line.Now, we can see the environment variable CNB_EXEC_ENV is available to the buildpack at execution time to the build/detect binaries.
Documentation
Related
Resolves #___