You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use BP_NATIVE_IMAGE=true and BP_DATADOG_ENABLED=true. Both add arguments to native-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
Paketo Buildpack for Datadog 4.6.0
[INFO] [creator] https://github.com/paketo-buildpacks/datadog
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_DATADOG_ENABLED true whether to contribute the Datadog trace agent
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_DATADOG_DISABLED false whether to disable the Datadog trace agent (non native-image Java applications only!)
[INFO] [creator] Datadog Java Agent 1.25.1: Contributing to layer
[INFO] [creator] Downloading from https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/1.25.1/dd-java-agent-1.25.1.jar
[INFO] [creator] Verifying checksum
[INFO] [creator] Copying to /layers/paketo-buildpacks_datadog/datadog-agent-java
[INFO] [creator] Writing env.build/BP_NATIVE_IMAGE_BUILD_ARGUMENTS.append
[INFO] [creator] Writing env.build/BP_NATIVE_IMAGE_BUILD_ARGUMENTS.delim
[INFO] [creator] Writing env.launch/BPI_DATADOG_AGENT_PATH.default
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Native Image 5.12.7
[INFO] [creator] https://github.com/paketo-buildpacks/native-image
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_BINARY_COMPRESSION_METHOD Compression mechanism used to reduce binary size. Options: `none` (default), `upx` or `gzexe`
[INFO] [creator] $BP_NATIVE_IMAGE true enable native image build
[INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS -O0 -J-Xmx7g arguments to pass to the native-image command
[INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE a file with arguments to pass to the native-image command
[INFO] [creator] $BP_NATIVE_IMAGE_BUILT_ARTIFACT the built application artifact explicitly, required if building from a JAR
[INFO] [creator] Native Image: Contributing to layer
[INFO] [creator] Executing native-image --no-fallback -H:+StaticExecutableWithDynamicLibC -O0 -J-Xmx7g -H:Name=/layers/paketo-buildpacks_native-image/native-image/com.mercedesbenz.blueprint.Application -cp ...
In last line Datadog agent configuration is missing.
BP_NATIVE_IMAGE_BUILD_ARGUMENTS not set
Paketo Buildpack for Datadog 4.6.0
[INFO] [creator] https://github.com/paketo-buildpacks/datadog
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_DATADOG_ENABLED true whether to contribute the Datadog trace agent
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_DATADOG_DISABLED false whether to disable the Datadog trace agent (non native-image Java applications only!)
[INFO] [creator] Datadog Java Agent 1.25.1: Contributing to layer
[INFO] [creator] Downloading from https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/1.25.1/dd-java-agent-1.25.1.jar
[INFO] [creator] Verifying checksum
[INFO] [creator] Copying to /layers/paketo-buildpacks_datadog/datadog-agent-java
[INFO] [creator] Writing env.build/BP_NATIVE_IMAGE_BUILD_ARGUMENTS.append
[INFO] [creator] Writing env.build/BP_NATIVE_IMAGE_BUILD_ARGUMENTS.delim
[INFO] [creator] Writing env.launch/BPI_DATADOG_AGENT_PATH.default
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Native Image 5.12.7
[INFO] [creator] https://github.com/paketo-buildpacks/native-image
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_BINARY_COMPRESSION_METHOD Compression mechanism used to reduce binary size. Options: `none` (default), `upx` or `gzexe`
[INFO] [creator] $BP_NATIVE_IMAGE true enable native image build
[INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS -J-javaagent:/layers/paketo-buildpacks_datadog/datadog-agent-java/dd-java-agent-1.25.1.jar arguments to pass to the native-image command
[INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE a file with arguments to pass to the native-image command
[INFO] [creator] $BP_NATIVE_IMAGE_BUILT_ARTIFACT the built application artifact explicitly, required if building from a JAR
[INFO] [creator] Native Image: Contributing to layer
[INFO] [creator] Executing native-image --no-fallback -H:+StaticExecutableWithDynamicLibC -J-javaagent:/layers/paketo-buildpacks_datadog/datadog-agent-java/dd-java-agent-1.25.1.jar -H:Name=/layers/paketo-buildpacks_native-image/native-image/com.mercedesbenz.blueprint.Application -cp ...
In 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:
[INFO] [creator] Paketo Buildpack for Native Image 5.12.7
...
[INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS -J-javaagent:/layers/paketo-buildpacks_datadog/datadog-agent-java/dd-java-agent-1.25.1.jar arguments to pass to the native-image command
...
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.
The text was updated successfully, but these errors were encountered:
tjuchniewicz
changed the title
BP_NATIVE_IMAGE_BUILD_ARGUMENTS replaces arguments added by BP_DATADOG_ENABLED=true
BP_NATIVE_IMAGE_BUILD_ARGUMENTS replaces arguments added by Datadog BP
Jan 2, 2024
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.
The text was updated successfully, but these errors were encountered: