Open tjuchniewicz opened 11 months ago
The way that native-image buildpack handles arguments for native image is different than the way we handle arguments in other buildpacks. Usually, with other buildpacks, the arguments you set just override the buildpack. We don't do that with native-image buildpack because it's complicated to get all the required native-image arguments right, some of which need to be set just so because of the way things work inside buildpacks.
To attempt to allow folks to also pass in arguments, we do some processing of the arguments, restricting/removing certain arguments. This is in an effort to prevent users from accidentally passing in an argument and breaking the build.
It is entirely possible that these extra precautions are preventing something legitimate from being passed in as an argument. I'd have to dig through that logic and see what I can find out.
The other possibility here is that the layer that's setting this environment variable is not a build layer. If it's not a build layer, you can still set build env variables, they just won't appear because the layer is not around when subsequent buildpacks run. A quick glance at the datadog bp code, and it looks like it should be a build layer. It looks like build is true when native image is true. Just mentioning this to be thorough.
We use
BP_NATIVE_IMAGE=true
andBP_DATADOG_ENABLED=true
. Both add arguments tonative-image
. Unfortunately native-image BP removes argument added by Datadog BP.Expected Behavior
native-image BP appends arguments
Current Behavior
native-image BP replaces arguments
Steps to Reproduce
BP_NATIVE_IMAGE_BUILD_ARGUMENTS=-O0 -J-Xmx7g
In last line Datadog agent configuration is missing.
BP_NATIVE_IMAGE_BUILD_ARGUMENTS
not setIn last line Datadog argument is included (
-J-javaagent:/layers/paketo-buildpacks_datadog/datadog-agent-java/dd-java-agent-1.25.1.jar
). Please see that native BP recognizes arguments added by Datadog:Workaround
Configure Datadog argument manually:
unfortunately this workaround will fail after Datadog BP upgrades agent version
Motivations
We want to use Native, Datadog and custom arguments in the same time due to need to change default native-build memory settings, disable optimizations etc.