-
Notifications
You must be signed in to change notification settings - Fork 325
Execution Environment RFC Implementation #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
Conversation
Signed-off-by: Juan Bustamante <[email protected]>
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 <[email protected]>
…in progress Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
|
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 <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
|
@jjbustamante Hi! Now that buildpacks/lifecycle#1539 is merged/released, are we ready to proceed with the changes on the Pack CLI side? :-) |
Hi @edmorley! Yes, I am gonna work on merging these changes and releasing |
|
Cross-linking the tracking issue for this: |
@edmorley just a quick update: I had to work on migrating |
Add missing import for github.com/buildpacks/lifecycle/api package required by execution environment tests that use api.MustParse(). The tests added in this branch for CNB_EXEC_ENV functionality reference api.Version and api.MustParse() but the import was missing, causing compilation errors after merging latest changes from main. Co-Authored-By: Claude Sonnet 4.5 <[email protected]> Signed-off-by: Juan Bustamante <[email protected]>
21acb9f to
fdcd0b4
Compare
|
I am going to test the branch again before merging with the steps I mentioned above, if everything is fine, I will merge the PR |
✅ Verified with Lifecycle 0.21.0 and Platform API 0.15I've successfully tested this PR with the official lifecycle 0.21.0 release, which includes Platform API 0.15 support and the Execution Environment feature. Test Setup
Test Command~/go/src/github.com/buildpacks/pack/out/pack build my-sample-ruby-app:with-exec-env \
--builder my-exec-env-builder:alpine \
--path ./ruby-bundler/ \
-v \
--exec-env testResults✅ Pack correctly passes
|
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 #___