Skip to content

Commit d01114e

Browse files
authored
Merge branch 'master' into kr-igor/kafka-lag-spark-streaming
2 parents 4d58aa0 + 4abf841 commit d01114e

File tree

780 files changed

+10618
-5473
lines changed

Some content is hidden

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

780 files changed

+10618
-5473
lines changed

.circleci/config.continue.yml.j2

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ debugger_test_matrix: &debugger_test_matrix
2828

2929
system_test_matrix: &system_test_matrix
3030
parameters:
31-
weblog-variant: [ 'spring-boot', 'spring-boot-jetty', 'spring-boot-openliberty', 'spring-boot-3-native', 'jersey-grizzly2', 'resteasy-netty3','ratpack', 'vertx3' ]
31+
weblog-variant: ['akka-http', 'jersey-grizzly2', 'play', 'resteasy-netty3', 'ratpack', 'spring-boot', 'spring-boot-jetty', 'spring-boot-openliberty', 'spring-boot-payara', 'spring-boot-undertow', 'spring-boot-wildfly', 'spring-boot-3-native', 'uds-spring-boot', 'vertx3', 'vertx4']
3232

3333
agent_integration_tests_modules: &agent_integration_tests_modules "dd-trace-core|communication|internal-api|utils"
3434
core_modules: &core_modules "dd-java-agent|dd-trace-core|communication|internal-api|telemetry|utils|dd-java-agent/agent-bootstrap|dd-java-agent/agent-installer|dd-java-agent/agent-tooling|dd-java-agent/agent-builder|dd-java-agent/appsec|dd-java-agent/agent-crashtracking|dd-trace-api|dd-trace-ot"
3535
instrumentation_modules: &instrumentation_modules "dd-java-agent/instrumentation|dd-java-agent/agent-tooling|dd-java-agent/agent-iast|dd-java-agent/agent-installer|dd-java-agent/agent-builder|dd-java-agent/agent-bootstrap|dd-java-agent/appsec|dd-java-agent/testing|dd-trace-core|dd-trace-api|internal-api|communication"
3636
debugger_modules: &debugger_modules "dd-java-agent/agent-debugger|dd-java-agent/agent-bootstrap|dd-java-agent/agent-builder|internal-api|communication|dd-trace-core"
3737
profiling_modules: &profiling_modules "dd-java-agent/agent-profiling"
3838

39-
default_system_tests_commit: &default_system_tests_commit 1c9542783eedfed1b995d976963fbeb14ba772b9
39+
default_system_tests_commit: &default_system_tests_commit c87bd359aad64a29f280fc5c70a879f7c7f4846e
4040

4141
parameters:
4242
nightly:
@@ -273,13 +273,6 @@ commands:
273273
git fetch origin << parameters.systemTestsCommit >>
274274
git reset --hard FETCH_HEAD
275275

276-
- run:
277-
name: Install python 3.12
278-
command: |
279-
sudo apt-get update
280-
sudo apt-get install -y python3.12-full python3.12-dev python3.12-venv
281-
echo 'export PATH="$HOME/.local/bin:$PATH"' >>"$BASH_ENV"
282-
283276
jobs:
284277
build:
285278
<<: *defaults
@@ -310,7 +303,7 @@ jobs:
310303
name: Build Project
311304
command: >-
312305
{% if is_nightly %}
313-
./gradlew resolveAndLockAll --write-locks
306+
./gradlew resolveAndLockAll --write-locks &&
314307
{% endif %}
315308
MAVEN_OPTS="-Xms64M -Xmx256M"
316309
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2560M -Xms2560M -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
@@ -1313,6 +1306,8 @@ build_test_jobs: &build_test_jobs
13131306
gradleParameters: "-PskipFlakyTests"
13141307
stage: smoke
13151308
cacheType: smoke
1309+
parallelism: 4
1310+
maxWorkers: 3
13161311
testJvm: "8"
13171312
13181313
- fan_in:

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ dd-java-agent/instrumentation/*iast* @DataDog/asm-java
4545
dd-java-agent/instrumentation/*appsec* @DataDog/asm-java
4646
dd-java-agent/instrumentation/json/ @DataDog/asm-java
4747
dd-java-agent/instrumentation/snakeyaml/ @DataDog/asm-java
48+
dd-java-agent/instrumentation/freemarker/ @DataDog/asm-java
4849
dd-smoke-tests/iast-util/ @DataDog/asm-java
4950
dd-smoke-tests/spring-security/ @DataDog/asm-java
5051
dd-java-agent/instrumentation/commons-fileupload/ @DataDog/asm-java

.github/workflows/README.md

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GitHub Actions Documentation
22

3-
This lists and describes the repository GitHub actions.
3+
This lists and describes the repository GitHub actions, how to maintain and test them.
44

55
## Release Management
66

@@ -18,15 +18,16 @@ _Trigger:_ When a release is published.
1818

1919
_Action:_ Append the new release to the Cloud Foundry repository.
2020

21-
_Recovery:_ Manually edit and push the `index.yml`file from [the cloudfoundry branch](https://github.com/DataDog/dd-trace-java/tree/cloudfoundry).
21+
_Recovery:_ Manually edit and push the `index.yml` file from [the cloudfoundry branch](https://github.com/DataDog/dd-trace-java/tree/cloudfoundry).
2222

2323
### create-next-milestone [🔗](create-next-milestone.yaml)
2424

2525
_Trigger:_ When closing a milestone.
2626

2727
_Action:_ Create a new milestone by incrementing minor version.
2828

29-
_Comment:_ Already done when closing a tag. To delete?
29+
_Comment:_ Disabled as also covered by increment-milestone-on-tag.
30+
This will be removed after some testing.
3031

3132
### draft-release-notes-on-tag [🔗](draft-release-notes-on-tag.yaml)
3233

@@ -40,18 +41,17 @@ _Actions:_
4041

4142
_Recovery:_ Manually trigger the action again on the relevant tag.
4243

43-
### increment-milestones-on-tag [🔗](increment-milestones-on-tag.yaml)
44+
### increment-milestone-on-tag [🔗](increment-milestone-on-tag.yaml)
4445

45-
_Trigger:_ When creating a tag. Release Candidate tags containing "-RC" or "-rc" will skip this.
46+
_Trigger:_ When creating a minor or major version tag.
4647

4748
_Actions:_
4849
* Close the milestone related to the tag,
4950
* Create a new milestone by incrementing minor version.
5051

51-
_Recovery:_ Manually close the related milestone and create a new one.
52+
_Recovery:_ Manually [close the related milestone and create a new one](https://github.com/DataDog/dd-trace-java/milestones).
5253

53-
_Notes:_ This actions will handle _minor_ releases only.
54-
As there is no milestone for _patch_ releases, it won't close and create _patch_ releated milestone.
54+
_Notes:_ This action will not apply to release candidate versions using `-RC` tags.
5555

5656
### update-download-releases [🔗](update-download-releases.yaml)
5757

@@ -74,52 +74,55 @@ _Action:_
7474

7575
_Recovery:_ Check at the milestone for the related issues and update them manually.
7676

77+
### prune-github-container-registry [🔗](prune-github-container-registry.yaml)
78+
79+
_Trigger:_ Every week or manually.
80+
81+
_Action:_ Clean up old lib-injection OCI images from GitHub Container Registry.
82+
83+
_Recovery:_ Manually trigger the action again.
84+
7785
## Code Quality and Security
7886

79-
### ci-static-analysis [🔗](ci-static-analysis.yml)
87+
### analyze-changes [🔗](analyze-changes-with-github-codeql.yaml)
8088

81-
_Trigger:_ When pushing commits to `master` or any pull request to `master`.
89+
_Trigger:_ When pushing commits to `master` or any pull request targeting `master`.
8290

83-
_Actions:_ Run [DataDog Static Analysis](https://docs.datadoghq.com/static_analysis/) and upload result to DataDog Code Analysis.
91+
_Action:_
92+
* Run [DataDog Static Analysis](https://docs.datadoghq.com/static_analysis/) and upload result to DataDog Code Analysis,
93+
* Run [GitHub CodeQL](https://codeql.github.com/) action, upload result to GitHub security tab and DataDog Code Analysis -- do not apply to pull request, only when pushing to `master`,
94+
* Run [Trivy security scanner](https://github.com/aquasecurity/trivy) on built artifacts and upload result to GitHub security tab.
8495

8596
### comment-on-submodule-update [🔗](comment-on-submodule-update.yaml)
8697

8798
_Trigger:_ When creating a PR commits to `master` or a `release/*` branch with a Git Submodule update.
8899

89100
_Action:_ Notify the PR author through comments that about the Git Submodule update.
90101

91-
### codeql-analysis [🔗](codeql-analysis.yml)
92-
93-
_Trigger:_ When pushing commits to `master`.
94-
95-
_Action:_ Run GitHub CodeQL action, upload result to GitHub security tab and DataDog Code Analysis.
96-
97-
### update-gradle-dependencies [🔗](trivy-analysis.yml)
102+
### update-gradle-dependencies [🔗](update-gradle-dependencies.yml)
98103

99104
_Trigger:_ Every week or manually.
100105

101106
_Action:_ Create a PR updating the Grade dependencies and their locking files.
102107

103108
_Recovery:_ Manually trigger the action again.
104109

105-
### trivy-analysis [🔗](trivy-analysis.yml)
106-
107-
_Trigger:_ When pushing commits to `master` or any pull request to `master`.
108110

109-
_Action:_ Run Trivy security scanner on built artifacts and upload result to GitHub security tab.
111+
## Maintenance
110112

111-
### gradle-wrapper-validation [🔗](gradle-wrapper-validation.yaml.disabled)
113+
GitHub actions should be part of the [repository allowed actions to run](https://github.com/DataDog/dd-trace-java/settings/actions).
114+
While GitHub owned actions are allowed by default, the other ones must be declared.
112115

113-
**DISABLED** - GitHub provides a way to disable actions rather than changing their extensions.
116+
Run the following script to get the list of actions to declare according the state of your working copy:
117+
```bash
118+
find .github/workflows -name "*.yaml" -exec awk '/uses:/{print $2 ","}' {} \; | grep -vE '^(actions|github)/' | sort | uniq
119+
```
114120

115-
_Comment:_ To delete?
121+
## Testing
116122

117-
## Lib Injection
123+
Workflows can be locally tested using the [`act` CLI](https://github.com/nektos/act/).
124+
The [.github/workflows/tests/](./tests) folder contains test scripts and event payloads to locally trigger workflows.
118125

119-
### lib-injection-prune-registry [🔗](lib-injection-prune-registry.yaml)
120-
121-
_Trigger:_ Every week or manually.
122-
123-
_Action:_ Clean up old lib-injection Docker images from GHCR.
124-
125-
_Recovery:_ Manually trigger the action again.
126+
> [!WARNING]
127+
> Locally running workflows will still query GitHub backend and will update the GitHub project accordingly.
128+
> Pay extra attention to the workflow jobs you trigger to not create development disruption.

.github/workflows/add-milestone-to-pull-requests.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ on:
55
branches:
66
- master
77
- release/v*
8-
98
jobs:
109
add_milestone_to_merged:
11-
if: github.event.pull_request.merged && github.event.pull_request.milestone == null
1210
name: Add milestone to merged pull requests
11+
permissions:
12+
issues: write # Required to update a pull request using the issues API
13+
pull-requests: write # Required to update the milestone of a pull request
14+
if: github.event.pull_request.merged && github.event.pull_request.milestone == null
1315
runs-on: ubuntu-latest
1416
steps:
1517
- name: Add milestone to merged pull requests

.github/workflows/add-release-to-cloudfoundry.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
- released
66
jobs:
77
update-releases:
8+
permissions:
9+
contents: write # Required to commit and push changes to the repository
810
runs-on: ubuntu-latest
911
steps:
1012
- name: Checkout "cloudfoundry" branch
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: Analyze changes
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ master ]
9+
10+
jobs:
11+
datadog-static-analyzer:
12+
name: Analyze changes with DataDog Static Analyzer
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6
17+
with:
18+
submodules: 'recursive'
19+
- name: Check code meets quality standards
20+
id: datadog-static-analysis
21+
uses: DataDog/datadog-static-analyzer-github-action@c74aff158c8cc1c3e285660713bcaa5f9c6d696e # v1
22+
with:
23+
dd_app_key: ${{ secrets.DD_APP_KEY }}
24+
dd_api_key: ${{ secrets.DD_API_KEY }}
25+
dd_site: datad0g.com
26+
dd_service: "dd-trace-java"
27+
dd_env: "ci"
28+
cpu_count: 2
29+
enable_performance_statistics: false
30+
31+
codeql:
32+
name: Analyze changes with GitHub CodeQL
33+
# Don’t run on PR, only when pushing to master
34+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
35+
runs-on: ubuntu-latest
36+
permissions:
37+
actions: read
38+
contents: read
39+
security-events: write # Required to upload the results to the Security tab
40+
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6
44+
with:
45+
submodules: 'recursive'
46+
47+
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
48+
with:
49+
path: |
50+
~/.gradle/caches
51+
~/.gradle/wrapper
52+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
53+
restore-keys: |
54+
${{ runner.os }}-gradle-
55+
56+
- name: Initialize CodeQL
57+
uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
58+
with:
59+
languages: 'java'
60+
build-mode: 'manual'
61+
62+
- name: Build dd-trace-java for creating the CodeQL database
63+
run: |
64+
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2G -Xms2G'" \
65+
JAVA_HOME=$JAVA_HOME_8_X64 \
66+
JAVA_8_HOME=$JAVA_HOME_8_X64 \
67+
JAVA_11_HOME=$JAVA_HOME_11_X64 \
68+
JAVA_17_HOME=$JAVA_HOME_17_X64 \
69+
JAVA_21_HOME=$JAVA_HOME_21_X64 \
70+
./gradlew clean :dd-java-agent:shadowJar \
71+
--build-cache --parallel --stacktrace --no-daemon --max-workers=4
72+
73+
- name: Perform CodeQL Analysis and upload results to GitHub Security tab
74+
uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
75+
76+
# For now, CodeQL SARIF results are not supported by Datadog CI
77+
# - name: Upload results to Datadog CI Static Analysis
78+
# run: |
79+
# wget --no-verbose https://github.com/DataDog/datadog-ci/releases/download/v2.42.0/datadog-ci_linux-x64 -O datadog-ci
80+
# chmod +x datadog-ci
81+
# ./datadog-ci sarif upload /home/runner/work/dd-trace-java/results/java.sarif --service dd-trace-java --env ci
82+
# env:
83+
# DD_API_KEY: ${{ secrets.DD_API_KEY }}
84+
# DD_SITE: datad0g.com
85+
86+
trivy:
87+
name: Analyze changes with Trivy
88+
runs-on: ubuntu-latest
89+
permissions:
90+
actions: read
91+
contents: read
92+
security-events: write # Required to upload the results to the Security tab
93+
94+
steps:
95+
- name: Checkout repository
96+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6
97+
with:
98+
submodules: 'recursive'
99+
100+
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
101+
with:
102+
path: |
103+
~/.gradle/caches
104+
~/.gradle/wrapper
105+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
106+
restore-keys: |
107+
${{ runner.os }}-gradle-
108+
109+
- name: Remove old artifacts
110+
run: |
111+
MVN_LOCAL_REPO=$(./mvnw help:evaluate -Dexpression=settings.localRepository -q -DforceStdout)
112+
echo "MVN_LOCAL_REPO=${MVN_LOCAL_REPO}" >> "$GITHUB_ENV"
113+
rm -rf "${MVN_LOCAL_REPO}/com/datadoghq"
114+
115+
- name: Build and publish artifacts locally
116+
run: |
117+
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2G -Xms2G'" \
118+
JAVA_HOME=$JAVA_HOME_8_X64 \
119+
JAVA_8_HOME=$JAVA_HOME_8_X64 \
120+
JAVA_11_HOME=$JAVA_HOME_11_X64 \
121+
JAVA_17_HOME=$JAVA_HOME_17_X64 \
122+
JAVA_21_HOME=$JAVA_HOME_21_X64 \
123+
./gradlew clean publishToMavenLocal \
124+
--build-cache --parallel --stacktrace --no-daemon --max-workers=4
125+
126+
- name: Copy published artifacts
127+
run: |
128+
mkdir -p ./workspace/.trivy
129+
cp -RP "${MVN_LOCAL_REPO}/com/datadoghq" ./workspace/.trivy/
130+
ls -laR "./workspace/.trivy"
131+
132+
- name: Run Trivy security scanner
133+
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # v0.24.0
134+
with:
135+
scan-type: rootfs
136+
scan-ref: './workspace/.trivy/'
137+
format: 'sarif'
138+
output: 'trivy-results.sarif'
139+
severity: 'CRITICAL,HIGH'
140+
limit-severities-for-sarif: true
141+
142+
- name: Upload Trivy scan results to GitHub Security tab
143+
uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
144+
if: always()
145+
with:
146+
sarif_file: 'trivy-results.sarif'
147+
148+
- name: Upload results to Datadog CI Static Analysis
149+
run: |
150+
wget --no-verbose https://github.com/DataDog/datadog-ci/releases/download/v2.42.0/datadog-ci_linux-x64 -O datadog-ci
151+
chmod +x datadog-ci
152+
./datadog-ci sarif upload trivy-results.sarif --service dd-trace-java --env ci
153+
env:
154+
DD_API_KEY: ${{ secrets.DD_API_KEY }}
155+
DD_SITE: datad0g.com

.github/workflows/ci-static-analysis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)