Description
Context
The Spring Boot plugins for Gradle and Maven allows configuring the Buildpacks task via properties in the build.gradle
or pom.xml
files. Some of the properties can be specified via convenient CLI options, which are especially useful when automating certain workflows such as in a CI environment or when automating a local development workflow on Kubernetes.
Feature Suggestion
It would be extremely useful if it was possible to pass environment variables to Buildpacks via CLI options. For example:
./gradlew bootBuildImage --environment BP_LIVE_RELOAD_ENABLED="true"
When multiple environment variables:
./gradlew bootBuildImage --environment BP_LIVE_RELOAD_ENABLED="true" --environment BPL_JAVA_NMT_ENABLED="false"
Why
Two main reasons why I'm suggesting this feature:
- The Paketo Buildpacks offer incredible flexibility and settings for production that can be toggled on/off via environment variables. It would be useful to have the possibility to pass environment variables in a CI pipeline to configure features that are not needed by default in a local environment.
- One of the features offered by Paketo Buildpacks is support for live reload, which needs to be activated via an environment variable. It works well paired with Spring Boot DevTools and a tool like Skaffold or Tilt, but it would be great if the extra environment variable could be configured via CLI only in the Skaffold/Tilt configuration rather than in the
build.gradle
/pom.xml
file.
Alternatives Considered
The alternative I considered would be to introduce some profiles/feature flags in the pom.xml
/build.gradle
and add the configuration needed only in CI or only for local development behind those. However, this has a huge impact on the developer experience and maintenance cost. Furthermore, for the CI use case, it means that it's not possible to centralise the configuration in a common pipeline since changes are needed in each project's build.gradle
or pom.xml
file (unless perhaps more complex settings are introduced, such as init.gradle
scripts or settings.xml
extra options, but those would not be viable alternatives for all the use cases).
Contributions
If you think this feature makes sense for Spring Boot, I volunteer my time to help implement it.