Skip to content
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
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
13 changes: 13 additions & 0 deletions libs/agent-sm/agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ base {

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

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

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

thirdPartyAudit {
ignoreMissingClasses(
'com.sun.jna.FunctionMapper',
Expand Down
8 changes: 5 additions & 3 deletions plugins/repository-hdfs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ project(':test:fixtures:krb5kdc-fixture').tasks.preProcessFixture {


// Create HDFS File System Testing Fixtures for HA/Secure combinations
def agentJarProvider = project(':libs:agent-sm:agent').tasks.named('jar').map { it.archiveFile.get() }
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
dependsOn { project(':libs:agent-sm:agent').tasks.named('prepareAgent') }
executable = "${BuildParams.runtimeJavaHome}/bin/java"
env 'CLASSPATH', "${-> configurations.hdfsFixture.asPath}"
maxWaitInSeconds = 60
Expand All @@ -140,10 +142,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:${-> agentJarProvider.get()}")

// 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
7 changes: 5 additions & 2 deletions test/framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ 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()]
def agentJarFile = project(':libs:agent-sm:agent').tasks.named('jar').map { it.archiveFile.get() }
dependsOn { project(':libs:agent-sm:agent').tasks.named('prepareAgent') }
doFirst {
jvmArgs "-javaagent:" + agentJarFile.get()
}
}

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