Skip to content
Open
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
44 changes: 44 additions & 0 deletions dd-smoke-tests/apm-tracing-disabled/application/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Spring Boot 2.7.x is the last line that still supports Java 8, which this smoke test
// exercises (see the `sourceCompatibility = '1.8'` below). Do not bump to 3.x without
// also moving the smoke test off Java 8.
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.15'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
Comment thread
AlexeyKuznetsov-DD marked this conversation as resolved.
}

def sharedRootDir = "$rootDir/../../../"
def sharedConfigDirectory = "$sharedRootDir/gradle"
rootProject.ext.sharedConfigDirectory = sharedConfigDirectory

apply from: "$sharedConfigDirectory/repositories.gradle"

if (hasProperty('appBuildDir')) {
buildDir = property('appBuildDir')
}

version = ""

java {
sourceCompatibility = '1.8'
}

if (hasProperty('apiJar')) {
dependencies {
implementation files(property('apiJar'))
}
} else {
dependencies {
implementation "com.datadoghq:dd-trace-api:+"
}
}

dependencies {
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.8'
implementation 'org.springframework.boot:spring-boot-starter-web'
// OpenTracing 0.32.0 is the last release and is intentionally pinned: this smoke test
// exercises the legacy OpenTracing bridge in dd-trace-ot. Do not "upgrade" — there is
// no newer version.
implementation group: 'io.opentracing', name: 'opentracing-api', version: '0.32.0'
implementation group: 'io.opentracing', name: 'opentracing-util', version: '0.32.0'
}
41 changes: 41 additions & 0 deletions dd-smoke-tests/apm-tracing-disabled/application/settings.gradle
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: settings.gradle in nested projects have somewhat the same duplicated configuration around repo proxies. And ci cache. I have no proper solution yet, but this should come as a follow-up work.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven
// mirrors used by CI when the public repos are unreachable; they are forwarded from the
// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the
// mirrors are reached over plain HTTP inside the CI network.
pluginManagement {
repositories {
mavenLocal()
if (settings.hasProperty("gradlePluginProxy")) {
maven {
url settings["gradlePluginProxy"]
allowInsecureProtocol = true
}
}
if (settings.hasProperty("mavenRepositoryProxy")) {
maven {
url settings["mavenRepositoryProxy"]
allowInsecureProtocol = true
}
}
gradlePluginPortal()
mavenCentral()
Comment thread
bric3 marked this conversation as resolved.
}
}

def isCI = providers.environmentVariable("CI").isPresent()

// On CI, point the local Gradle build cache to the shared workspace directory under the
// repository root, so cache entries are reused across the many smoke-test nested builds
// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the
// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default
// per-user cache to avoid leaking entries into the repo tree.
if (isCI) {
def sharedRootDir = "$rootDir/../../../"
buildCache {
local {
directory = "$sharedRootDir/workspace/build-cache"
}
}
}

rootProject.name = 'apm-tracing-disabled-smoketest'
38 changes: 17 additions & 21 deletions dd-smoke-tests/apm-tracing-disabled/build.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
import org.springframework.boot.gradle.tasks.bundling.BootJar

plugins {
id 'java'
id 'org.springframework.boot' version '2.7.15'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'dd-trace-java.smoke-test-app'
id 'java-test-fixtures'
}

apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/spring-boot-plugin.gradle"

description = 'ASM Standalone Billing Tests.'

java {
sourceCompatibility = '1.8'
smokeTestApp {
application {
taskName = 'bootJar'
artifactPath = 'libs/apm-tracing-disabled-smoketest.jar'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as idea: how about to calculate default name of artifactPath from module name by template?
Like (pseudocode): libs/$moduleName-smoke-test.jar? With all needed .toLowerCase() and replace if needed. WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, I'll take a look in a follow up pr

sysProperty = 'datadog.smoketest.springboot.shadowJar.path'
}
projectJar('apiJar', project(':dd-trace-api'))
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation group: 'io.opentracing', name: 'opentracing-api', version: '0.32.0'
implementation group: 'io.opentracing', name: 'opentracing-util', version: '0.32.0'
implementation project(':dd-trace-api')
testImplementation project(':dd-smoke-tests')
testImplementation(testFixtures(project(":dd-smoke-tests:iast-util")))
}

tasks.withType(Test).configureEach {
def bootJarTask = tasks.named('bootJar', BootJar)
dependsOn bootJarTask
jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
return bootJarTask.map { ["-Ddatadog.smoketest.springboot.shadowJar.path=${it.archiveFile.get()}"] }.get()
}
})
spotless {
java {
target "**/*.java"
}

groovyGradle {
target '*.gradle', "**/*.gradle"
}
}
42 changes: 42 additions & 0 deletions dd-smoke-tests/kafka-2/application/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Spring Boot 2.7.x is the last line that still supports Java 8, which this smoke test
// exercises (see the Java 8 `sourceCompatibility` below). Do not bump to 3.x without
// also moving the smoke test off Java 8.
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.15'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
Comment thread
AlexeyKuznetsov-DD marked this conversation as resolved.
}

def sharedRootDir = "$rootDir/../../../"
def sharedConfigDirectory = "$sharedRootDir/gradle"
rootProject.ext.sharedConfigDirectory = sharedConfigDirectory

apply from: "$sharedConfigDirectory/repositories.gradle"

if (hasProperty('appBuildDir')) {
buildDir = property('appBuildDir')
}

version = ""

// Pin bytecode target: the nested daemon now runs on JDK 21, but the smoke test launches
// the produced jar on Java 8.
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}

// `iastUtilJar` is wired up by the outer `smokeTestApp { projectJar('iastUtilJar', ...) }`
// block in ../build.gradle: it passes the path of the built `:dd-smoke-tests:iast-util`
// jar into this nested build as a Gradle property. We add it as a flat-file dependency
// because the outer build's projects are not addressable from inside the nested build.
if (hasProperty('iastUtilJar')) {
Comment thread
AlexeyKuznetsov-DD marked this conversation as resolved.
dependencies {
implementation files(property('iastUtilJar'))
}
}

dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-actuator')
implementation('org.springframework.kafka:spring-kafka')
}
41 changes: 41 additions & 0 deletions dd-smoke-tests/kafka-2/application/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven
// mirrors used by CI when the public repos are unreachable; they are forwarded from the
// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the
// mirrors are reached over plain HTTP inside the CI network.
pluginManagement {
repositories {
mavenLocal()
if (settings.hasProperty("gradlePluginProxy")) {
maven {
url settings["gradlePluginProxy"]
allowInsecureProtocol = true
}
}
if (settings.hasProperty("mavenRepositoryProxy")) {
maven {
url settings["mavenRepositoryProxy"]
allowInsecureProtocol = true
}
}
gradlePluginPortal()
mavenCentral()
}
}

def isCI = providers.environmentVariable("CI").isPresent()

// On CI, point the local Gradle build cache to the shared workspace directory under the
// repository root, so cache entries are reused across the many smoke-test nested builds
// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the
// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default
// per-user cache to avoid leaking entries into the repo tree.
if (isCI) {
Comment thread
AlexeyKuznetsov-DD marked this conversation as resolved.
def sharedRootDir = "$rootDir/../../../"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why in some places sharedRooDir is under if (CI) and in some places it is not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the more I think about this, the more I think this build cache config is useless for nested smoke test projects. Given build cache is disabled by default and that the nested gradle jobs (existing or new via this PR) don't leverage the build-cache (there's neither --build-cache or org.gradle.caching=true). Consequently the buildCache { local { directory = … } } block is useless.

buildCache {
local {
directory = "$sharedRootDir/workspace/build-cache"
}
}
Comment on lines +34 to +38
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's comment the knowledge behind such non-trivial-Gradle configs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note existing smoke tests already had this for quite some time, it just follows what's been there, it seems to have been introduced by b34ccbc, and has been applied to other smoke tests, prior my changes.

The buildcache dir config referes to the root level cache that was introduced in f6ec1f5 #982

I'll add the comments in a follow-up pr.

}

rootProject.name = 'kafka-2-smoketest'
44 changes: 23 additions & 21 deletions dd-smoke-tests/kafka-2/build.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
import org.springframework.boot.gradle.tasks.bundling.BootJar

plugins {
id 'org.springframework.boot' version '2.7.15'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'dd-trace-java.smoke-test-app'
id 'java-test-fixtures'
}

apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/spring-boot-plugin.gradle"
description = 'Kafka 2.x Smoke Tests.'

dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-actuator')
implementation('org.springframework.kafka:spring-kafka')
description = 'Kafka 2.x Smoke Tests.'

testImplementation('org.springframework.kafka:spring-kafka-test')
smokeTestApp {
application {
taskName = 'bootJar'
artifactPath = 'libs/kafka-2-smoketest.jar'
sysProperty = 'datadog.smoketest.springboot.shadowJar.path'
}
projectJar('iastUtilJar', project(':dd-smoke-tests:iast-util'))
}

dependencies {
// Pinned: this version was previously resolved transitively from the Spring Boot BOM in
// the outer build. Now that the application is in a nested build, the BOM is no longer
// available here.
testImplementation('org.springframework.kafka:spring-kafka-test:2.8.11')
testImplementation project(':dd-smoke-tests')
implementation project(':dd-smoke-tests:iast-util')
testImplementation(testFixtures(project(":dd-smoke-tests:iast-util")))
}

tasks.withType(Test).configureEach {
def bootJarTask = tasks.named('bootJar', BootJar)
dependsOn bootJarTask
jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
return bootJarTask.map { ["-Ddatadog.smoketest.springboot.shadowJar.path=${it.archiveFile.get()}"] }.get()
}
})
spotless {
java {
target "**/*.java"
}

groovyGradle {
target '*.gradle', "**/*.gradle"
}
}
38 changes: 38 additions & 0 deletions dd-smoke-tests/openfeature/application/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.15'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}

def sharedRootDir = "$rootDir/../../../"
def sharedConfigDirectory = "$sharedRootDir/gradle"
rootProject.ext.sharedConfigDirectory = sharedConfigDirectory

apply from: "$sharedConfigDirectory/repositories.gradle"

if (hasProperty('appBuildDir')) {
buildDir = property('appBuildDir')
}

version = ""

// Java 11 (not Java 8 like the other Spring Boot 2.x smoke tests): the OpenFeature SDK
// requires Java 11+. This matches what the outer (pre-nested) build was doing before
// the application was extracted into this nested build.
java {
sourceCompatibility = 11
targetCompatibility = 11
}
Comment on lines +22 to +25
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious why Java 11 with old spring boot 2.7.15?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The app was compiled with Java 11 before

tasks.named("compileJava", JavaCompile) {
configureCompiler(it, 11, JavaVersion.VERSION_11)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If app compiled with Java 11, maybe Gradle plugins can be bumped?


if (hasProperty('featureFlaggingApiJar')) {
dependencies {
implementation files(property('featureFlaggingApiJar'))
}
}

dependencies {
// OpenFeature SDK is an API dependency of feature-flagging-api but is not
// transitively resolved when the jar is passed as a files() dependency.
implementation 'dev.openfeature:sdk:1.20.1'
implementation 'org.springframework.boot:spring-boot-starter-web'
}
41 changes: 41 additions & 0 deletions dd-smoke-tests/openfeature/application/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven
// mirrors used by CI when the public repos are unreachable; they are forwarded from the
// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the
// mirrors are reached over plain HTTP inside the CI network.
pluginManagement {
repositories {
mavenLocal()
if (settings.hasProperty("gradlePluginProxy")) {
maven {
url settings["gradlePluginProxy"]
allowInsecureProtocol = true
}
}
if (settings.hasProperty("mavenRepositoryProxy")) {
maven {
url settings["mavenRepositoryProxy"]
allowInsecureProtocol = true
}
}
gradlePluginPortal()
mavenCentral()
}
}

def isCI = providers.environmentVariable("CI").isPresent()

// On CI, point the local Gradle build cache to the shared workspace directory under the
// repository root, so cache entries are reused across the many smoke-test nested builds
// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the
// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default
// per-user cache to avoid leaking entries into the repo tree.
if (isCI) {
def sharedRootDir = "$rootDir/../../../"
buildCache {
local {
directory = "$sharedRootDir/workspace/build-cache"
Comment on lines +33 to +36
Copy link
Copy Markdown
Contributor

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious why in some projects sharedRootDir hardcoded, and some under isCI?

}
}
}

rootProject.name = 'openfeature-smoketest'
Loading