Skip to content

Commit bce66f7

Browse files
authored
Merge branch 'master' into andrea.marziali/tibco
2 parents 3bd5cc4 + b7fb6fc commit bce66f7

762 files changed

Lines changed: 19145 additions & 1649 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,6 @@
188188
# @DataDog/rum
189189
/internal-api/src/main/java/datadog/trace/api/rum/ @DataDog/rum
190190
/internal-api/src/test/groovy/datadog/trace/api/rum/ @DataDog/rum
191+
/dd-smoke-tests/rum/ @DataDog/rum
191192
/telemetry/src/main/java/datadog/telemetry/rum/ @DataDog/rum
192193
/telemetry/src/test/groovy/datadog/telemetry/rum/ @DataDog/rum

.github/dependabot.yml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for all configuration options:
4-
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5-
61
version: 2
72
updates:
8-
- package-ecosystem: "github-actions"
9-
directory: "/"
10-
schedule:
11-
interval: "weekly"
12-
labels:
13-
- "comp: tooling"
14-
- "tag: dependencies"
15-
- "tag: no release notes"
16-
commit-message:
17-
prefix: "chore(ci): "
18-
groups:
19-
gh-actions-packages:
20-
patterns:
21-
- "*"
22-
23-
- package-ecosystem: "gradle"
24-
directory: "/"
25-
schedule:
26-
interval: "weekly"
27-
allow:
28-
- dependency-name: "gradle"
29-
ignore:
30-
- dependency-name: "gradle"
31-
update-types: ["version-update:semver-major"]
32-
labels:
33-
- "comp: tooling"
34-
- "tag: dependencies"
35-
- "tag: no release notes"
36-
commit-message:
37-
prefix: "chore(build): "
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
labels:
8+
- 'comp: tooling'
9+
- 'tag: dependencies'
10+
- 'tag: no release notes'
11+
commit-message:
12+
prefix: 'chore(ci): '
13+
groups:
14+
gh-actions-packages:
15+
patterns:
16+
- '*'
17+
cooldown:
18+
default-days: 14
19+
- package-ecosystem: gradle
20+
directory: /
21+
schedule:
22+
interval: weekly
23+
allow:
24+
- dependency-name: gradle
25+
ignore:
26+
- dependency-name: gradle
27+
update-types:
28+
- version-update:semver-major
29+
labels:
30+
- 'comp: tooling'
31+
- 'tag: dependencies'
32+
- 'tag: no release notes'
33+
commit-message:
34+
prefix: 'chore(build): '
35+
cooldown:
36+
default-days: 14

.github/workflows/create-release-branch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
run: |
120120
git config user.name "github-actions[bot]"
121121
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
122-
git commit -m "chore: Pin system-tests for release branch" .github/workflows/run-system-tests.yaml
122+
git commit -m "chore: Pin system-tests for release branch" .github/workflows/run-system-tests.yaml .gitlab-ci.yml
123123
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
124124
125125
- name: Push changes

.github/workflows/run-system-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
needs:
6363
- build
6464
# If you change the following comment, update the pattern in the update_system_test_reference.sh script to match.
65-
uses: DataDog/system-tests/.github/workflows/system-tests.yml@main # system tests are pinned for releases only
65+
uses: DataDog/system-tests/.github/workflows/system-tests.yml@main # system tests are pinned on release branches only
6666
secrets:
6767
TEST_OPTIMIZATION_API_KEY: ${{ secrets.DATADOG_API_KEY_PROD }}
6868
permissions:
@@ -72,7 +72,7 @@ jobs:
7272
with:
7373
library: java
7474
# If you change the following comment, update the pattern in the update_system_test_reference.sh script to match.
75-
ref: main # system tests are pinned for releases only
75+
ref: "main" # system tests are pinned on release branches only
7676
binaries_artifact: binaries
7777
desired_execution_time: 900 # 15 minutes
7878
scenarios_groups: tracer-release

.gitlab-ci.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,24 @@ maven-central-pre-release-check:
222222
image: ${BUILDER_IMAGE_REPO}:${BUILDER_IMAGE_VERSION_PREFIX}base
223223
stage: .pre
224224
rules:
225+
- if: '$CI_COMMIT_BRANCH == "master"'
226+
when: on_success
227+
allow_failure: false
225228
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
226229
when: on_success
227230
allow_failure: false
228231
script:
229232
- |
230233
MAVEN_CENTRAL_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_username --with-decryption --query "Parameter.Value" --out text)
231234
MAVEN_CENTRAL_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_password --with-decryption --query "Parameter.Value" --out text)
232-
# See https://central.sonatype.org/publish/publish-portal-api/
233-
# 15e0cbbb-deff-421e-9e02-296a24d0cada is deployment, any deployment id listed in central work, the idea is to check whether the token can authenticate
234-
curl --request POST --include --fail https://central.sonatype.com/api/v1/publisher/status?id=15e0cbbb-deff-421e-9e02-296a24d0cada --header "Authorization: Bearer $(printf "$MAVEN_CENTRAL_USERNAME:$MAVEN_CENTRAL_PASSWORD" | base64)"
235-
if [ $? -ne 0 ]; then
236-
echo "Failed to authenticate against central. Check credentials, see https://datadoghq.atlassian.net/wiki/x/Oog5OgE"
235+
# See https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/
236+
# Use the staging API search endpoint to validate the tokens without relying on a specific deployment
237+
AUTHORIZATION_HEADER="Authorization: Bearer $(printf '%s:%s' "$MAVEN_CENTRAL_USERNAME" "$MAVEN_CENTRAL_PASSWORD" | base64)"
238+
if ! curl --silent --show-error --fail \
239+
"https://ossrh-staging-api.central.sonatype.com/manual/search/repositories?ip=any" \
240+
--header "$AUTHORIZATION_HEADER" \
241+
> /dev/null; then
242+
echo "Failed to authenticate tokens against maven central staging API. Check credentials and see https://datadoghq.atlassian.net/wiki/x/Oog5OgE"
237243
exit 1
238244
fi
239245
@@ -641,7 +647,7 @@ muzzle-dep-report:
641647
CI_USE_TEST_AGENT: "true"
642648
CI_AGENT_HOST: local-agent
643649
services:
644-
- name: ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.33.1
650+
- name: registry.ddbuild.io/images/mirror/dd-apm-test-agent/ddapm-test-agent:v1.44.0
645651
alias: local-agent
646652
variables:
647653
LOG_LEVEL: "DEBUG"
@@ -803,7 +809,12 @@ aggregate_test_counts:
803809
rules:
804810
- if: '$POPULATE_CACHE'
805811
when: never
806-
- when: always
812+
- if: '$CI_COMMIT_BRANCH == "master"'
813+
when: on_success
814+
- if: '$CI_COMMIT_BRANCH =~ /^mq-working-branch-/'
815+
when: on_success
816+
- if: '$CI_COMMIT_BRANCH =~ /^gh-readonly-queue/'
817+
when: on_success
807818
script:
808819
- *set_datadog_api_keys
809820
- .gitlab/aggregate_test_counts.sh
@@ -1034,6 +1045,7 @@ publishing-gate:
10341045

10351046
configure_system_tests:
10361047
variables:
1048+
SYSTEM_TESTS_REF: "main" # system tests are pinned on release branches only
10371049
SYSTEM_TESTS_SCENARIOS_GROUPS: "simple_onboarding,simple_onboarding_profiling,simple_onboarding_appsec,docker-ssi,lib-injection"
10381050

10391051
create_key:

.gitlab/one-pipeline.locked.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# DO NOT EDIT THIS FILE MANUALLY
22
# This file is auto-generated by automation.
33
include:
4-
- remote: https://gitlab-templates.ddbuild.io/libdatadog/one-pipeline/ca/f14ac28614630d12bcfe6cba4fd8d72dce142c62ff0b053ba7c323622104ebd7/one-pipeline.yml
4+
- remote: https://gitlab-templates.ddbuild.io/libdatadog/one-pipeline/ca/9cf7d7609ff62e4723c9cbc061ca2a25345ce5d6055b9acad9a13dbf736261f0/one-pipeline.yml

build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
id("dd-trace-java.config-inversion-linter")
1212
id("dd-trace-java.ci-jobs")
1313

14-
id("com.diffplug.spotless") version "8.2.1"
14+
id("com.diffplug.spotless") version "8.4.0"
1515
id("me.champeau.gradle.japicmp") version "0.4.3"
1616
id("com.github.spotbugs") version "6.4.8"
1717
id("de.thetaphi.forbiddenapis") version "3.10"
@@ -38,7 +38,8 @@ with(extensions["spotlessPredeclare"] as SpotlessExtension) {
3838
java {
3939
removeUnusedImports()
4040

41-
googleJavaFormat("1.34.1")
41+
googleJavaFormat("1.35.0")
42+
tableTestFormatter("1.1.1")
4243
}
4344
groovyGradle {
4445
greclipse()

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
`java-gradle-plugin`
33
`kotlin-dsl`
44
`jvm-test-suite`
5-
id("com.diffplug.spotless") version "8.2.1"
5+
id("com.diffplug.spotless") version "8.4.0"
66
}
77

88
// The buildSrc still needs to target Java 8 as build time instrumentation and muzzle plugin

buildSrc/call-site-instrumentation-plugin/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
java
3-
id("com.diffplug.spotless") version "8.2.1"
3+
id("com.diffplug.spotless") version "8.4.0"
44
id("com.gradleup.shadow") version "8.3.9"
55
}
66

@@ -16,7 +16,7 @@ spotless {
1616
target("src/**/*.java")
1717
// ignore embedded test projects
1818
targetExclude("src/test/resources/**")
19-
googleJavaFormat("1.34.1")
19+
googleJavaFormat("1.35.0")
2020
}
2121
}
2222

buildSrc/src/test/kotlin/datadog/gradle/plugin/GradleFixture.kt

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,111 @@ import org.gradle.testkit.runner.UnexpectedBuildResultException
66
import org.intellij.lang.annotations.Language
77
import org.w3c.dom.Document
88
import java.io.File
9+
import java.nio.file.Files
910
import javax.xml.parsers.DocumentBuilderFactory
1011

1112
/**
1213
* Base fixture for Gradle plugin integration tests.
1314
* Provides common functionality for setting up test projects and running Gradle builds.
1415
*/
1516
internal open class GradleFixture(protected val projectDir: File) {
17+
// Each fixture gets its own testkit dir in the system temp directory (NOT under
18+
// projectDir) so that JUnit's @TempDir cleanup doesn't race with daemon file locks.
19+
// See https://github.com/gradle/gradle/issues/12535
20+
// A fresh daemon is started per test — ensuring withEnvironment() vars (e.g.
21+
// MAVEN_REPOSITORY_PROXY) are correctly set on the daemon JVM and not inherited
22+
// from a previously-started daemon with a different test's environment.
23+
// A JVM shutdown hook removes the directory after all tests have run (and daemons
24+
// have been stopped), so file locks are guaranteed to be released by then.
25+
private val testKitDir: File by lazy {
26+
Files.createTempDirectory("gradle-testkit-").toFile().also { dir ->
27+
Runtime.getRuntime().addShutdownHook(Thread { dir.deleteRecursively() })
28+
}
29+
}
30+
1631
/**
1732
* Runs Gradle with the specified arguments.
1833
*
34+
* After the build completes, any Gradle daemons started by TestKit are killed
35+
* so their file locks on the testkit cache are released before JUnit `@TempDir`
36+
* cleanup. See https://github.com/gradle/gradle/issues/12535
37+
*
1938
* @param args Gradle task names and arguments
2039
* @param expectFailure Whether the build is expected to fail
2140
* @param env Environment variables to set (merged with system environment)
2241
* @return The build result
2342
*/
2443
fun run(vararg args: String, expectFailure: Boolean = false, env: Map<String, String> = emptyMap()): BuildResult {
2544
val runner = GradleRunner.create()
26-
// Use a testkit dir scoped to this fixture's projectDir. The Tooling API always uses a
27-
// daemon and ignores org.gradle.daemon=false. By giving each test its own testkit dir,
28-
// we force a fresh daemon per test — ensuring withEnvironment() vars (e.g.
29-
// MAVEN_REPOSITORY_PROXY) are correctly set on the daemon JVM and not inherited from
30-
// a previously-started daemon with a different test's environment.
31-
.withTestKitDir(file(".testkit"))
45+
.withTestKitDir(testKitDir)
3246
.withPluginClasspath()
3347
.withProjectDir(projectDir)
48+
// Using withDebug prevents starting a daemon, but it doesn't work with withEnvironment
3449
.withEnvironment(System.getenv() + env)
3550
.withArguments(*args)
3651
return try {
3752
if (expectFailure) runner.buildAndFail() else runner.build()
3853
} catch (e: UnexpectedBuildResultException) {
3954
e.buildResult
55+
} finally {
56+
stopDaemons()
4057
}
4158
}
4259

60+
/**
61+
* Kills Gradle daemons started by TestKit for this fixture's testkit dir.
62+
*
63+
* The Gradle Tooling API (used by [GradleRunner]) always spawns a daemon and
64+
* provides no public API to stop it (https://github.com/gradle/gradle/issues/12535).
65+
* We replicate the strategy Gradle uses in its own integration tests
66+
* ([DaemonLogsAnalyzer.killAll()][1]):
67+
*
68+
* 1. Scan `<testkit>/daemon/<version>/` for log files matching
69+
* `DaemonLogConstants.DAEMON_LOG_PREFIX + pid + DaemonLogConstants.DAEMON_LOG_SUFFIX`,
70+
* i.e. `daemon-<pid>.out.log`.
71+
* 2. Extract the PID from the filename and kill the process.
72+
*
73+
* Trade-offs of the PID-from-filename approach:
74+
* - **PID recycling**: between the build finishing and `kill` being sent, the OS
75+
* could theoretically recycle the PID. In practice the window is short
76+
* (the `finally` block runs immediately after the build) so the risk is negligible.
77+
* - **Filename convention is internal**: Gradle's `DaemonLogConstants.DAEMON_LOG_PREFIX`
78+
* (`"daemon-"`) / `DAEMON_LOG_SUFFIX` (`".out.log"`) are not public API; a future
79+
* Gradle version could change them. The `toLongOrNull()` guard safely skips entries
80+
* that don't parse as a PID (including the UUID fallback Gradle uses when the PID
81+
* is unavailable).
82+
* - **Java 8 compatible**: uses `kill`/`taskkill` via [ProcessBuilder] instead of
83+
* `ProcessHandle` (Java 9+) because build logic targets JVM 1.8.
84+
*
85+
* [1]: https://github.com/gradle/gradle/blob/43b381d88/testing/internal-distribution-testing/src/main/groovy/org/gradle/integtests/fixtures/daemon/DaemonLogsAnalyzer.groovy
86+
*/
87+
private fun stopDaemons() {
88+
val daemonDir = File(testKitDir, "daemon")
89+
if (!daemonDir.exists()) return
90+
91+
daemonDir.walkTopDown()
92+
.filter { it.isFile && it.name.endsWith(".out.log") && !it.name.startsWith("hs_err") }
93+
.forEach { logFile ->
94+
val pid = logFile.nameWithoutExtension // daemon-12345.out
95+
.removeSuffix(".out") // daemon-12345
96+
.removePrefix("daemon-") // 12345
97+
.toLongOrNull() ?: return@forEach // skip UUIDs / unparseable names
98+
99+
val isWindows = System.getProperty("os.name").lowercase().contains("win")
100+
val killProcess = if (isWindows) {
101+
ProcessBuilder("taskkill", "/F", "/PID", pid.toString())
102+
} else {
103+
ProcessBuilder("kill", pid.toString())
104+
}
105+
try {
106+
val process = killProcess.redirectErrorStream(true).start()
107+
process.waitFor(5, java.util.concurrent.TimeUnit.SECONDS)
108+
} catch (_: Exception) {
109+
// best effort — daemon may already be stopped
110+
}
111+
}
112+
}
113+
43114
/**
44115
* Adds a subproject to the build.
45116
* Updates settings.gradle and creates the build script for the subproject.

0 commit comments

Comments
 (0)