diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 51d6be1..340036f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/README.md b/README.md index 1a47775..bcac7cb 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/install_test_visibility.sh b/install_test_visibility.sh index 4f1353f..720b157 100755 --- a/install_test_visibility.sh +++ b/install_test_visibility.sh @@ -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" @@ -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)" @@ -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}')"