Skip to content

Commit 1b3a925

Browse files
M-TsurHarness
authored andcommitted
feat: [CI-18706]: Add support for the new native Java agent (#398)
* 97fdbf Merge branch 'main' into CI-18706 * 3afe7a Merge branch 'CI-18708' into CI-18706 * cf3796 Merge branch 'main' into CI-18708 * b40dc8 feat: [CI-18706]: Renamed flag * b1e02e Merge branch 'CI-18708' into CI-18706 * ba448c feat: [CI-18708]: Renamed flag * 387086 Merge branch 'CI-18708' into CI-18706 * 8ed4f6 Merge branch 'CI-18435-i' into CI-18708 * 8d2a1f Merge branch 'CI-18776' into CI-18435-i * a44e68 Merge branch 'CI-17478-i' into CI-18776 * c22c54 Merge branch 'main' into CI-17478-i * 5fe482 fix: [CI-18776]: Fix powershell ruby & python commands * 054d43 feat: [CI-18706]: Add support for the new native Java agent * e344b9 feat: [CI-18708]: Add support for the new native Python agent * 92da63 feat: [CI-18435]: Don't specify wheel file if plugin file is present for python agent * 97d9bb feat: [CI-17478]: Prevent running agent setup commands (PreCmd) if the shell is python * d63cbd Revert "fix:[CI-18679]: Revert "feat+ci~14385+Enable test splitting even when int
1 parent c69fee0 commit 1b3a925

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pipeline/runtime/runtestsV2.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const (
5252
dotNetAgentV2Path = "/dotnet/v2/"
5353
dotNetConfigV2Dir = "%s/ti/v2/dotnet/config"
5454
javascriptRequireFile = "ti-agent.cjs"
55+
nativeJavaAgentV2Name = "java-agent-trampoline.jar"
5556
pythonAgentScript = "harness_ti_plugin"
5657
)
5758

@@ -617,6 +618,21 @@ fi
617618
}
618619
}
619620

621+
if javaFFVal, ok := envs["CI_ENABLE_RUNTESTV2_JAVA_V2_FF"]; ok && javaFFVal == trueValue {
622+
javaAgentPathLinux := fmt.Sprintf("%s%slinux/%s", tmpFilePath, dotNetAgentV2Path, nativeJavaAgentV2Name)
623+
javaAgentPathAlpine := fmt.Sprintf("%s%salpine/%s", tmpFilePath, dotNetAgentV2Path, nativeJavaAgentV2Name)
624+
625+
envs["JAVA_TOOL_OPTIONS"] = fmt.Sprintf("-javaagent:%s", javaAgentPathLinux)
626+
envs["JAVA_TOOL_OPTIONS_ALPINE"] = fmt.Sprintf("-javaagent:%s", javaAgentPathAlpine)
627+
envs["JAVA_TOOL_OPTIONS_LINUX"] = fmt.Sprintf("-javaagent:%s", javaAgentPathLinux)
628+
629+
if !isPsh {
630+
preCmd += "\nif cat /etc/os-release | grep -iq alpine ; then export JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS_ALPINE; fi;"
631+
} else {
632+
preCmd += "\nIf (Get-Content /etc/os-release | %{$_ -match 'alpine'}) { [System.Environment]::SetEnvironmentVariable('JAVA_TOOL_OPTIONS', [System.Environment]::GetEnvironmentVariable('JAVA_TOOL_OPTIONS_ALPINE')); }"
633+
}
634+
}
635+
620636
if pythonFFVal, ok := envs["CI_ENABLE_RUNTESTV2_PYTHON_V2_FF"]; ok && pythonFFVal == trueValue {
621637
pythonAgentPathLinux := fmt.Sprintf("%s%slinux/%s", tmpFilePath, dotNetAgentV2Path, pythonAgentScript)
622638
pythonAgentPathAlpine := fmt.Sprintf("%s%salpine/%s", tmpFilePath, dotNetAgentV2Path, pythonAgentScript)

0 commit comments

Comments
 (0)