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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ gradle.projectsEvaluated {

// Add Java Agent for security sandboxing
if (!(project.path in [':build-tools', ":libs:agent-sm:bootstrap", ":libs:agent-sm:agent"])) {
dependsOn(project(':libs:agent-sm:agent').prepareAgent)
jvmArgs += ["-javaagent:" + project(':libs:agent-sm:agent').jar.archiveFile.get()]
dependsOn(project(':libs:agent-sm:agent').tasks.named('prepareAgent'))
jvmArgs += ["-javaagent:" + project(':libs:agent-sm:agent').tasks.named('jar').get().archiveFile.get()]
}
if (BuildParams.isInFipsJvm()) {
def fipsSecurityFile = project.rootProject.file('distribution/src/config/fips_java.security')
Expand Down
6 changes: 6 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ if (project != rootProject) {
suppressPomMetadataWarningsFor("testFixturesApiElements")
suppressPomMetadataWarningsFor("testFixturesRuntimeElements")
}

// Gradle 9.4 changed the default to enforce stricter validation. Disabling
// the validation for now and will follow up with a fix.
tasks.validatePlugins {
enableStricterValidation = false
}
}

// Define this here because we need it early. It uses VersionCatalogsExtension to extract all versions
Expand Down
2 changes: 1 addition & 1 deletion distribution/archives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,6 @@ tasks.configureEach { t ->

tasks.each {
if (it.name.startsWith("build")) {
it.dependsOn project(':libs:agent-sm:agent').assemble
it.dependsOn project(':libs:agent-sm:agent').tasks.named('assemble')
}
}
13 changes: 12 additions & 1 deletion distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import java.nio.file.Path
plugins {
id 'base'
}


/*****************************************************************************
* Third party dependencies report *
*****************************************************************************/
Expand Down Expand Up @@ -320,6 +322,13 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
}
}
}
create('agent') {
canBeConsumed = false
canBeResolved = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, 'agent-dist'))
}
}
}

dependencies {
Expand All @@ -333,6 +342,8 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
libsFipsInstallerCli project(path: ':distribution:tools:fips-demo-installer-cli')

bcFips libs.bundles.bouncycastle

agent project(path: ':libs:agent-sm:agent', configuration: 'agentDist')
}

project.ext {
Expand Down Expand Up @@ -362,7 +373,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {

agentFiles = {
copySpec {
from(project(':libs:agent-sm:agent').prepareAgent) {
from(configurations.agent) {
include '**/*.jar'
exclude '**/*-javadoc.jar'
exclude '**/*-sources.jar'
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=f86344275d1b194688dd330abf9f6f2344cd02872ffee035f2d1ea2fd60cf7f3
distributionSha256Sum=b21468753cb43c167738ee04f10c706c46459cf8f8ae6ea132dc9ce589a261f2
21 changes: 21 additions & 0 deletions libs/agent-sm/agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ base {

configurations {
bootstrap.extendsFrom(implementation)
agentDist {
canBeConsumed = true
canBeResolved = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, 'agent-dist'))
}
}
agentJar {
canBeConsumed = true
canBeResolved = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, 'agent-jar'))
}
}
}

dependencies {
Expand Down Expand Up @@ -53,6 +67,13 @@ task prepareAgent(type: Copy) {
dependsOn jar
}

artifacts {
agentJar(jar)
agentDist(file("$buildDir/distributions")) {
builtBy prepareAgent
}
}

thirdPartyAudit {
ignoreMissingClasses(
'com.sun.jna.FunctionMapper',
Expand Down
15 changes: 12 additions & 3 deletions plugins/repository-hdfs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ testFixtures.useFixture ":test:fixtures:krb5kdc-fixture", "hdfs"

configurations {
hdfsFixture
agent {
canBeConsumed = false
canBeResolved = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, 'agent-jar'))
}
}
}

dependencies {
Expand Down Expand Up @@ -88,6 +95,8 @@ dependencies {
if (isEclipse == false) {
testRuntimeOnly files(project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("hdfs", "hdfs_hdfs.build.opensearch.org.keytab").parent)
}

agent project(path: ':libs:agent-sm:agent', configuration: 'agentJar')
}

restResources {
Expand Down Expand Up @@ -130,7 +139,7 @@ project(':test:fixtures:krb5kdc-fixture').tasks.preProcessFixture {
// Create HDFS File System Testing Fixtures for HA/Secure combinations
for (String fixtureName : ['hdfsFixture', 'haHdfsFixture', 'secureHdfsFixture', 'secureHaHdfsFixture']) {
def tsk = tasks.register(fixtureName, org.opensearch.gradle.test.AntFixture) {
dependsOn configurations.hdfsFixture, project(':test:fixtures:krb5kdc-fixture').tasks.postProcessFixture, project(':libs:agent-sm:agent').prepareAgent
dependsOn configurations.hdfsFixture, project(':test:fixtures:krb5kdc-fixture').tasks.postProcessFixture, configurations.agent
executable = "${BuildParams.runtimeJavaHome}/bin/java"
env 'CLASSPATH', "${-> configurations.hdfsFixture.asPath}"
maxWaitInSeconds = 60
Expand All @@ -140,10 +149,10 @@ for (String fixtureName : ['hdfsFixture', 'haHdfsFixture', 'secureHdfsFixture',
// it's ready, so we can just wait for the file to exist
return fixture.portsFile.exists()
}
final List<String> miniHDFSArgs = []
final List miniHDFSArgs = []

// See please https://issues.apache.org/jira/browse/HADOOP-19486
miniHDFSArgs.add("-javaagent:" + project(':libs:agent-sm:agent').jar.archiveFile.get())
miniHDFSArgs.add("-javaagent:${-> configurations.agent.incoming.artifactView({}).files.singleFile}")

// If it's a secure fixture, then depend on Kerberos Fixture and principals + add the krb5conf to the JVM options
if (fixtureName.equals('secureHdfsFixture') || fixtureName.equals('secureHaHdfsFixture')) {
Expand Down
15 changes: 13 additions & 2 deletions test/framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ apply plugin: 'opensearch.build'
apply plugin: 'opensearch.publish'
apply from: "$rootDir/gradle/fips.gradle"

configurations {
agent {
canBeConsumed = false
canBeResolved = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, 'agent-jar'))
}
}
}

dependencies {
api project(":client:rest")
api project(":client:sniffer")
Expand Down Expand Up @@ -60,6 +70,8 @@ dependencies {
compileOnly "com.github.spotbugs:spotbugs-annotations:4.9.8"

annotationProcessor "org.apache.logging.log4j:log4j-core:${versions.log4j}"

agent project(path: ':libs:agent-sm:agent', configuration: 'agentJar')
}

compileJava.options.compilerArgs -= '-Xlint:cast'
Expand Down Expand Up @@ -105,8 +117,7 @@ test {
systemProperty 'tests.gradle_wire_compat_versions', BuildParams.bwcVersions.wireCompatible.join(',')
systemProperty 'tests.gradle_unreleased_versions', BuildParams.bwcVersions.unreleased.join(',')

dependsOn(project(':libs:agent-sm:agent').prepareAgent)
jvmArgs += ["-javaagent:" + project(':libs:agent-sm:agent').jar.archiveFile.get()]
jvmArgs += ["-javaagent:${-> configurations.agent.incoming.artifactView({}).files.singleFile}"]
}

tasks.register("integTest", Test) {
Expand Down
Loading