CLI for building apps using Cloud Native Buildpacks
Go to file
Juan Bustamante 94348a5314
Execution Environment RFC Implementation (#2324)
* WIP - adding flag to set the CNB_EXEC_ENV

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* adding . and - to the regular expression to validate and cnn exec env

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* WIP - adding exec-env on project.toml schema verion 0.3, it is still in progress

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* fixing some lint errors

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* WIP - refacting test case

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* adding more test cases

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* adding exec-env to builder.toml

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* adding exec-env to builder.toml

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* Adding unit test for exec-env in buildpack.toml

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* Removing for now the platform API version validation

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* Fixing unit tests

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* fixing some unit tests

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* Fixing formatting issue

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* Test Coverage Improvements Summary

  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>

* Fixing Acceptance Tests API Platform expected versions

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* fix: add missing api import in phase_config_provider_test

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 <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

---------

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-22 20:45:27 -05:00
.github Fix link to `Get Started with Podman` page (#2511) 2026-01-11 16:27:04 -05:00
acceptance chore: migrate from docker/docker to moby/moby client (#2512) 2026-01-20 07:20:36 -05:00
benchmarks chore: migrate from docker/docker to moby/moby client (#2512) 2026-01-20 07:20:36 -05:00
builder Execution Environment RFC Implementation (#2324) 2026-01-22 20:45:27 -05:00
buildpackage Execution Environment RFC Implementation (#2324) 2026-01-22 20:45:27 -05:00
cmd chore: migrate from docker/docker to moby/moby client (#2512) 2026-01-20 07:20:36 -05:00
internal Execution Environment RFC Implementation (#2324) 2026-01-22 20:45:27 -05:00
pkg Execution Environment RFC Implementation (#2324) 2026-01-22 20:45:27 -05:00
registry
resources
testdata
testhelpers chore: migrate from docker/docker to moby/moby client (#2512) 2026-01-20 07:20:36 -05:00
tools fix: upgrade Go to 1.25.5 to address CVE-2025-61729 and CVE-2025-61727 (#2501) 2025-12-10 07:39:43 -05:00
.gitignore
.gitpod.yml
CODEOWNERS Update CODEOWNERS 2022-11-03 21:31:00 +02:00
CONTRIBUTING.md
DEVELOPMENT.md Merge branch 'main' into fix-pack-1218 2024-11-13 07:21:06 -05:00
Dockerfile Bump to go 1.25 (#2480) 2025-11-23 11:37:07 -05:00
LICENSE
Makefile Bump to go 1.25 (#2480) 2025-11-23 11:37:07 -05:00
README.md
RELEASE.md
codecov.yml
go.mod chore: migrate from docker/docker to moby/moby client (#2512) 2026-01-20 07:20:36 -05:00
go.sum chore: migrate from docker/docker to moby/moby client (#2512) 2026-01-20 07:20:36 -05:00
golangci.yaml Address linter errors 2025-04-08 08:14:16 +01:00
main.go Make `go build` work without Makefile (#2390) 2025-06-03 07:47:11 -05:00
project.toml

README.md

pack - Buildpack CLI

Build results Go Report Card codecov GoDoc GitHub license CII Best Practices Slack Gitpod ready-to-code

pack makes it easy for...

  • App Developers to use buildpacks to convert code into runnable images.
  • Buildpack Authors to develop and package buildpacks for distribution.
  • Operators to package buildpacks for distribution and maintain applications.

Usage

Getting Started

Get started by running through our tutorial: An Apps Brief Journey from Source to Image

Contributing

  • CONTRIBUTING - Information on how to contribute, including the pull request process.
  • DEVELOPMENT - Further detail to help you during the development process.
  • RELEASE - Further details about our release process.

Documentation

Check out the command line documentation here

Specifications

pack is a CLI implementation of the Platform Interface Specification for Cloud Native Buildpacks.

To learn more about the details, check out the specs repository.