Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ variables:
AWS_MAX_ATTEMPTS: 5 # retry AWS operations 5 times if they fail on network errors
DATADOG_AGENT_BUILDERS: v9930706-ef9d493
S3_CP_CMD: aws s3 cp --only-show-errors --region us-east-1 --sse AES256
SCRIPT_VERSION: 2
SCRIPT_VERSION: 3

deploy:
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-builders/gitlab_agent_deploy:$DATADOG_AGENT_BUILDERS
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The script parameters are
- `DD_SET_TRACER_VERSION_JAVA`: (optional) Version of the Java tracer to install (without the `v` prefix, e.g. `1.37.1`). If not provided, the latest version is installed.
- `DD_SET_TRACER_VERSION_JS`: (optional) Version of the JS tracer to install. If not provided, the latest version is installed.
- `DD_SET_TRACER_VERSION_PYTHON`: (optional) Version of the Python tracer to install. If not provided, the latest version is installed.
- `DD_INSTRUMENTATION_BUILD_SYSTEM_JAVA`: (optional) A hint for Java instrumentation to instrument a specific build system. Allowed values are `maven` and `gradle`. If not specified, all Java processes will be instrumented.
- `DD_INSTRUMENTATION_BUILD_SYSTEM_JAVA`: (optional) A hint for Java instrumentation to instrument a specific build system. Allowed values are `maven`, `gradle`, `sbt`, `ant`, and `all`. If not specified, every Maven, Gradle, SBT, and Ant build will be instrumented. `all` is a special value that allows instrumenting _every JVM process_.

The script will install the libraries and print the list of environment variables that should be set in order to enable Test Visibility. Example output:
```shell
Expand Down
18 changes: 15 additions & 3 deletions install_test_visibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ install_java_tracer() {
maven)
echo "MAVEN_OPTS=-javaagent:$filepath_tracer $MAVEN_OPTS"
;;
*)
sbt)
echo "SBT_OPTS=-javaagent:$filepath_tracer SBT_OPTS"
;;
ant)
echo "ANT_OPTS=-javaagent:$filepath_tracer ANT_OPTS"
;;
all)
local updated_java_tool_options="-javaagent:$filepath_tracer $JAVA_TOOL_OPTIONS"
if [ ${#updated_java_tool_options} -le 1024 ]; then
echo "JAVA_TOOL_OPTIONS=$updated_java_tool_options"
Expand All @@ -49,6 +55,12 @@ install_java_tracer() {
return 1
fi
;;
*)
echo "GRADLE_OPTS=-Dorg.gradle.jvmargs=-javaagent:$filepath_tracer $GRADLE_OPTS"
echo "MAVEN_OPTS=-javaagent:$filepath_tracer $MAVEN_OPTS"
echo "SBT_OPTS=-javaagent:$filepath_tracer $SBT_OPTS"
echo "ANT_OPTS=-javaagent:$filepath_tracer $ANT_OPTS"
;;
esac

echo "DD_TRACER_VERSION_JAVA=$(command -v java >/dev/null 2>&1 && java -jar $filepath_tracer || unzip -p $filepath_tracer META-INF/MANIFEST.MF | grep -i implementation-version | cut -d' ' -f2)"
Expand Down Expand Up @@ -138,8 +150,8 @@ install_js_tracer() {
echo "DD_TRACE_PACKAGE=$dd_trace_ci_init_path"
fi
# We can't set the --import flag directly in NODE_OPTIONS since it's only compatible from Node.js>=20.6.0 and Node.js>=18.19,
# not even if !is_github_actions.
# Additionally, it's not useful for test frameworks other than vitest, which is ESM first.
# not even if !is_github_actions.
# Additionally, it's not useful for test frameworks other than vitest, which is ESM first.
echo "DD_TRACE_ESM_IMPORT=$dd_trace_register_path"

echo "DD_TRACER_VERSION_JS=$(npm list -g dd-trace | grep dd-trace | awk -F@ '{print $2}')"
Expand Down