Support configuring bootBuildImage's environment through the command line#48792
Closed
HuitaePark wants to merge 1 commit intospring-projects:mainfrom
Closed
Support configuring bootBuildImage's environment through the command line#48792HuitaePark wants to merge 1 commit intospring-projects:mainfrom
HuitaePark wants to merge 1 commit intospring-projects:mainfrom
Conversation
Accumulate command line --environment values in a ListProperty and merge them with the configured environment when building the effective environment map. Add a test that verifies multiple entries are accepted and propagated. Closes spring-projectsGH-45306 Signed-off-by: HuitaePark <[email protected]>
2105ee6 to
c9cff7d
Compare
wilkinsona
pushed a commit
that referenced
this pull request
Jan 12, 2026
Accumulate command line --environment values in a ListProperty and merge them with the configured environment when building the effective environment map. Add a test that verifies multiple entries are accepted and propagated. See gh-48792 Signed-off-by: HuitaePark <[email protected]>
wilkinsona
added a commit
that referenced
this pull request
Jan 12, 2026
Member
|
Thanks very much, @HuitaePark. |
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
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.
This PR is intentionally opened as a draft to gather feedback on the overall approach.
Related Issue
Closes #45306
Goal
Add support for passing Buildpacks environment variables to the bootBuildImage task via CLI options.
This is particularly useful for CI pipelines and automated local workflows (e.g., Kubernetes, Skaffold, or Tilt), where modifying build.gradle or pom.xml to set dynamic values is often undesirable.
Background
In BootBuildImage, the environment configuration is currently defined as a MapProperty<String, String>:
However, Gradle’s "Option" annotation does not support Map types, making it impossible to directly expose this property as a CLI option.
As discussed in #45306, this PR explores an alternative approach where CLI-provided values are collected separately as a list and then mapped into the existing environment property.
Approach
Introduce a CLI-only input:
Use an "Internal" ListProperty to capture the raw options provided by the user.
Validation & Parsing:
The input strings are parsed into key-value pairs at execution time.
Strictly enforces the KEY=VALUE format.
If the format is invalid (e.g., missing the = separator), the task fails immediately with a GradleException to provide clear feedback to the user.
Example error: "Invalid value for option '--environment'. Expected 'NAME=VALUE' but got '...'."
The parsed values are merged into the existing environment (MapProperty), allowing CLI options to complement or override build script configurations.
CLI Usage