Skip to content

Fix build due to phasing off SecurityManager usage in favor of Java Agent #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 27 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,18 @@ opensearchplugin {
noticeFile rootProject.file('NOTICE')
}

configurations {
agent
}


dependencies {
api "com.github.luben:zstd-jni:1.5.6-1"
api "com.intel.qat:qat-java:1.1.1"

agent "org.opensearch:opensearch-agent-bootstrap:${opensearch_version}"
agent "org.opensearch:opensearch-agent:${opensearch_version}"
agent "net.bytebuddy:byte-buddy:1.17.5"
}

allprojects {
Expand Down Expand Up @@ -196,17 +205,24 @@ tasks.named("testingConventions").configure {
}
}

internalClusterTest {
dependsOn "prepareAgent"
jvmArgs += ["-javaagent:" + project.layout.buildDirectory.file("agent/opensearch-agent-${opensearch_version}.jar").get()]
}

integTest {
description = "Run tests against a cluster"
testClassesDirs = sourceSets.integTest.output.classesDirs
classpath = sourceSets.integTest.runtimeClasspath

dependsOn "bundlePlugin"
dependsOn "bundlePlugin", "prepareAgent"
systemProperty 'tests.security.manager', 'true'

systemProperty "https", System.getProperty("https")
systemProperty "user", System.getProperty("user")
systemProperty "password", System.getProperty("password")

jvmArgs += ["-javaagent:" + project.layout.buildDirectory.file("agent/opensearch-agent-${opensearch_version}.jar").get()]
}

testClusters.integTest {
Expand All @@ -232,3 +248,13 @@ task updateVersion {
ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true)
}
}

task prepareAgent(type: Copy) {
from(configurations.agent)
into "$buildDir/agent"
}

tasks.test {
dependsOn prepareAgent
jvmArgs += ["-javaagent:" + project.layout.buildDirectory.file("agent/opensearch-agent-${opensearch_version}.jar").get()]
}
4 changes: 4 additions & 0 deletions src/main/plugin-metadata/plugin-security.policy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* compatible open source license.
*/

grant {
permission java.net.NetPermission "accessUnixDomainSocket";
}

grant codeBase "${codebase.zstd-jni}" {
permission java.lang.RuntimePermission "loadLibrary.*";
};
Expand Down
Loading