Skip to content

Commit 5c473fc

Browse files
committed
Fix build due to phasing off SecurityManager usage in favor of Java Agent
Signed-off-by: Andriy Redko <drreta@gmail.com>
1 parent 885659f commit 5c473fc

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

build.gradle

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,18 @@ opensearchplugin {
9191
noticeFile rootProject.file('NOTICE')
9292
}
9393

94+
configurations {
95+
agent
96+
}
97+
98+
9499
dependencies {
95100
api "com.github.luben:zstd-jni:1.5.6-1"
96101
api "com.intel.qat:qat-java:1.1.1"
102+
103+
agent "org.opensearch:opensearch-agent-bootstrap:${opensearch_version}"
104+
agent "org.opensearch:opensearch-agent:${opensearch_version}"
105+
agent "net.bytebuddy:byte-buddy:1.17.5"
97106
}
98107

99108
allprojects {
@@ -201,12 +210,14 @@ integTest {
201210
testClassesDirs = sourceSets.integTest.output.classesDirs
202211
classpath = sourceSets.integTest.runtimeClasspath
203212

204-
dependsOn "bundlePlugin"
213+
dependsOn "bundlePlugin", "prepareAgent"
205214
systemProperty 'tests.security.manager', 'true'
206215

207216
systemProperty "https", System.getProperty("https")
208217
systemProperty "user", System.getProperty("user")
209218
systemProperty "password", System.getProperty("password")
219+
220+
jvmArgs += ["-javaagent:" + project.layout.buildDirectory.file("agent/opensearch-agent-${opensearch_version}.jar").get()]
210221
}
211222

212223
testClusters.integTest {
@@ -232,3 +243,14 @@ task updateVersion {
232243
ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true)
233244
}
234245
}
246+
247+
task prepareAgent(type: Copy) {
248+
from(configurations.agent)
249+
into "$buildDir/agent"
250+
}
251+
252+
tasks.test {
253+
dependsOn prepareAgent
254+
jvmArgs += ["-javaagent:" + project.layout.buildDirectory.file("agent/opensearch-agent-${opensearch_version}.jar").get()]
255+
}
256+

src/main/plugin-metadata/plugin-security.policy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
* compatible open source license.
77
*/
88

9+
grant {
10+
permission java.net.NetPermission "accessUnixDomainSocket";
11+
}
12+
913
grant codeBase "${codebase.zstd-jni}" {
1014
permission java.lang.RuntimePermission "loadLibrary.*";
1115
};

0 commit comments

Comments
 (0)