Skip to content

Commit

Permalink
Merge branch 'master' into mario.vidal/json_parser_propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariovido committed Sep 30, 2024
2 parents 8696030 + efa3824 commit 367dec7
Show file tree
Hide file tree
Showing 1,161 changed files with 29,229 additions and 15,264 deletions.
27 changes: 14 additions & 13 deletions .circleci/config.continue.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ parameters:
global_pattern:
# Pattern for files that should always trigger a test jobs
type: string
default: "^build.gradle$|^settings.gradle$|^gradle.properties$|^buildSrc/|^gradle/|.circleci"
default: "^build.gradle$|^settings.gradle$|^gradle.properties$|^buildSrc/|^gradle/|.circleci|^gradlew|^mvnw|^.mvn/"

docker_image:
type: string
Expand Down Expand Up @@ -660,7 +660,8 @@ jobs:
- DD_POOL_TRACE_CHECK_FAILURES=true
- DD_DISABLE_ERROR_RESPONSES=true
- ENABLED_CHECKS=trace_content_length,trace_stall,meta_tracer_version_header,trace_count_header,trace_peer_service,trace_dd_service
resource_class: xlarge
# TODO: merge xlarge_tests and tests? or rename this?
resource_class: large


# The only way to do fan-in in CircleCI seems to have a proper job, so let's have one that
Expand Down Expand Up @@ -1099,8 +1100,8 @@ build_test_jobs: &build_test_jobs
triggeredBy: *instrumentation_modules
stage: instrumentation
cacheType: inst
parallelism: 4
maxWorkers: 4
parallelism: 12
maxWorkers: 3
matrix:
<<: *test_matrix
Expand All @@ -1113,8 +1114,8 @@ build_test_jobs: &build_test_jobs
triggeredBy: *instrumentation_modules
stage: instrumentation
cacheType: inst
parallelism: 4
maxWorkers: 4
parallelism: 12
maxWorkers: 3
testJvm: "8"
- xlarge_tests:
Expand All @@ -1127,8 +1128,8 @@ build_test_jobs: &build_test_jobs
triggeredBy: *instrumentation_modules
stage: instrumentation
cacheType: latestdep
parallelism: 4
maxWorkers: 4
parallelism: 12
maxWorkers: 3
testJvm: "8"
- xlarge_tests:
Expand All @@ -1141,8 +1142,8 @@ build_test_jobs: &build_test_jobs
triggeredBy: *instrumentation_modules
stage: instrumentation
cacheType: latestdep
parallelism: 4
maxWorkers: 4
parallelism: 12
maxWorkers: 3
testJvm: "17"
- xlarge_tests:
Expand All @@ -1155,8 +1156,8 @@ build_test_jobs: &build_test_jobs
triggeredBy: *instrumentation_modules
stage: instrumentation
cacheType: latestdep
parallelism: 4
maxWorkers: 4
parallelism: 12
maxWorkers: 3
testJvm: "21"
{% if flaky %}
Expand Down Expand Up @@ -1184,7 +1185,7 @@ build_test_jobs: &build_test_jobs
triggeredBy: *instrumentation_modules
stage: instrumentation
cacheType: inst
parallelism: 2
parallelism: 12
maxWorkers: 4
testJvm: "8"
Expand Down
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dd-java-agent/instrumentation/*iast* @DataDog/asm-java
dd-java-agent/instrumentation/*appsec* @DataDog/asm-java
dd-java-agent/instrumentation/json/ @DataDog/asm-java
dd-java-agent/instrumentation/snakeyaml/ @DataDog/asm-java
dd-java-agent/instrumentation/velocity/ @DataDog/asm-java
dd-java-agent/instrumentation/freemarker/ @DataDog/asm-java
dd-smoke-tests/iast-util/ @DataDog/asm-java
dd-smoke-tests/spring-security/ @DataDog/asm-java
Expand All @@ -54,6 +55,9 @@ dd-java-agent/instrumentation/spring-security-5/ @DataDog/asm-java
**/iast/ @DataDog/asm-java
**/Iast*.java @DataDog/asm-java
**/Iast*.groovy @DataDog/asm-java
**/rasp/ @Datadog/asm-java
**/*Rasp*.java @DataDog/asm-java
**/*Rasp*.groovy @DataDog/asm-java

# @DataDog/data-jobs-monitoring
dd-java-agent/instrumentation/spark/ @DataDog/data-jobs-monitoring
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/analyze-changes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
with:
submodules: 'recursive'

- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
- name: Cache Gradle dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/.gradle/caches
Expand Down Expand Up @@ -97,7 +98,8 @@ jobs:
with:
submodules: 'recursive'

- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
- name: Cache Gradle dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/.gradle/caches
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/comment-on-submodule-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
comment_on_submodule_update:
permissions:
issues: write # Required to create a comment on the pull request
pull-requests: write # Required to create a comment on the pull request
runs-on: ubuntu-latest

steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source "$(dirname "$0")/../env.sh"
testworkflow pull_request

This file was deleted.

37 changes: 31 additions & 6 deletions .github/workflows/tests/env.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
#!/bin/sh
#!/bin/bash

# Move to project root directory
FILE_PATH=$(dirname "$0")
cd $FILE_PATH/../../../../

export COMMON_ACT_ARGS="--container-architecture linux/amd64 --secret GITHUB_TOKEN="$(gh auth token)" --verbose"
function testworkflow() {
local EVENT_TYPE=$1
# Get workflow name
local TEST_PATH
TEST_PATH=$(dirname "$(readlink -f "${BASH_SOURCE[1]}")")
local WORKFLOW_NAME
WORKFLOW_NAME=$(basename "$TEST_PATH")
local WORKFLOW_FILE=.github/workflows/${WORKFLOW_NAME}.yaml
local PAYLOAD_FILE=${TEST_PATH}/payload-${EVENT_TYPE//_/-}.json
# Move to project root directory
local FILE_PATH
FILE_PATH=$(dirname "$0")
cd "$FILE_PATH/../../../../" || exit 1
# Check if workflow file and payload file exist
if [ ! -f "$WORKFLOW_FILE" ]; then
echo "Workflow file not found: $WORKFLOW_FILE"
exit 1
fi
if [ ! -f "$PAYLOAD_FILE" ]; then
echo "Payload file not found: $PAYLOAD_FILE"
exit 1
fi
# Run workflow using act
act "${EVENT_TYPE}" \
--workflows "${WORKFLOW_FILE}" \
--eventpath "${PAYLOAD_FILE}" \
--container-architecture linux/amd64 \
--secret GITHUB_TOKEN="$(gh auth token)" \
--verbose
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source "$(dirname "$0")/../env.sh"
testworkflow create
3 changes: 0 additions & 3 deletions .github/workflows/tests/increment-milestone-on-tag/test.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"release": {
"name": "1.39.0",
"html_url": "https://github.com/DataDog/dd-trace-java/releases/tag/v1.39.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"inputs": {
"milestone": "1.39.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source "$(dirname "$0")/../env.sh"
testworkflow release
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source "$(dirname "$0")/../env.sh"
testworkflow workflow_dispatch
4 changes: 4 additions & 0 deletions .github/workflows/update-gradle-dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ jobs:
COUNT=0
fi
done
# Check at uncommited files
echo "Checking uncommited files"
git status
# Create a PR from the created branch
if [ $COUNT -gt 0 ]; then
echo "Creating a commit to $BRANCH_NAME@$BRANCH_HEAD with $GH_ADD_ARGS"
ghcommit --repository ${{ github.repository }} --branch $BRANCH_NAME --sha $BRANCH_HEAD $GH_ADD_ARGS --message "chore: Update Gradle dependencies"
Expand Down
81 changes: 43 additions & 38 deletions .github/workflows/update-issues-on-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,59 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Get milestone for release
id: milestone
uses: actions/github-script@47f7cf65b5ced0830a325f705cad64f2f58dddf7 # 3.1.0
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # 7.0.1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const milestone_name = ("${{github.event_name}}" == "workflow_dispatch") ?
"${{github.event.inputs.milestone}}" : "${{github.event.release.name}}"
const milestones = await github.paginate(github.issues.listMilestones, {
// Get release milestone name
const milestoneName = "${{github.event_name}}" == "workflow_dispatch" ?
"${{github.event.inputs.milestone}}" :
"${{github.event.release.name}}"
// Get release URL
const releaseURL = "${{github.event_name}}" == "workflow_dispatch" ?
"${{github.event.repository.html_url}}/releases/tag/v${{github.event.release.name}}" :
"${{github.event.release.html_url}}"
core.info(`Notify of release availability: v${milestoneName}`)
// Get release milestone number
const milestoneNumber = await github.paginate(github.rest.issues.listMilestones, {
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all'
})
return milestones.find( milestone => milestone.title == milestone_name ).number
- name: Get issues for milestone
id: issues
uses: actions/github-script@47f7cf65b5ced0830a325f705cad64f2f58dddf7 # 3.1.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issues = await github.paginate(github.issues.listForRepo, {
}, (response, done) => {
const releaseMilestone = response.data.find(milestone => milestone.title == milestoneName)
if (releaseMilestone) {
done()
return releaseMilestone.number
}
}).then(milestones => milestones.pop())
if (!milestoneNumber) {
core.setFailed(`Failed to find milestone: ${milestoneName}`)
return
}
// Get all release milestone issues
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
milestone: ${{steps.milestone.outputs.result}}
})
// Pull requests are issues so filter them out
return issues.filter( issue => !issue["pull_request"] ).map( issue => issue.number )
- name: Comment and close issues
uses: actions/github-script@47f7cf65b5ced0830a325f705cad64f2f58dddf7 # 3.1.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
for (let issue_number of ${{ steps.issues.outputs.result }}) {
// This can be parallelized better by moving the await but it might trip rate limits
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: ':robot: This issue has been addressed in the latest release. See full details in the [Release Notes]( ${{ github.event.release.html_url }}).'
})
await github.issues.update({
milestone: milestoneNumber
}, (response) => response.data.filter(issue => !issue["pull_request"]))
// Comment and close issues
for (const issue of issues) {
core.info(issue.state == 'open' ?
`Commenting and closing issue ${issue.number}` :
`Commenting on closed issue ${issue.number}`)
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
state: 'closed'
issue_number: issue.number,
body: `:robot: This issue has been addressed in the latest release. Check full details in the [Release Notes](${releaseURL}).`
})
if (issue.state == 'open') {
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed'
})
}
}
5 changes: 4 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ package-oci:
onboarding_tests_installer:
parallel:
matrix:
- ONBOARDING_FILTER_WEBLOG: [test-app-java, test-app-java-container, test-app-java-container-jdk15, test-app-java-alpine-libgcc, test-app-java-buildpack]
- ONBOARDING_FILTER_WEBLOG: [test-app-java, test-app-java-container, test-app-java-container-jdk15, test-app-java-alpine-libgcc]
SCENARIO: [ SIMPLE_INSTALLER_AUTO_INJECTION, SIMPLE_AUTO_INJECTION_PROFILING ]
- ONBOARDING_FILTER_WEBLOG: [test-app-java-buildpack]
SCENARIO: [ SIMPLE_INSTALLER_AUTO_INJECTION ]

onboarding_tests_k8s_injection:
variables:
Expand Down
2 changes: 1 addition & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This documentation is dedicated to developers to setup their environment, and bu

## Development environment quick check

As a preliminary step, you can quickly check that your development environment is properly set up to build the project running `./setup.sh` from the project root:
To check that your development environment is properly set up to build the project, you will eventually run `./setup.sh` from the project root and should have its output look something like this:

```bash
$ ./setup.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ public BackendApiFactory(Config config, SharedCommunicationObjects sharedCommuni
"Agentless mode is enabled and api key is not set. Please set application key");
}
String traceId = config.getIdGenerationStrategy().generateTraceId().toString();
long timeoutMillis = config.getCiVisibilityBackendApiTimeoutMillis();
return new IntakeApi(agentlessUrl, apiKey, traceId, timeoutMillis, retryPolicyFactory, true);
return new IntakeApi(
agentlessUrl,
apiKey,
traceId,
retryPolicyFactory,
sharedCommunicationObjects.okHttpClient,
true);
}

DDAgentFeaturesDiscovery featuresDiscovery =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@ public IntakeApi(
HttpUrl hostUrl,
String apiKey,
String traceId,
long timeoutMillis,
HttpRetryPolicy.Factory retryPolicyFactory,
OkHttpClient httpClient,
boolean responseCompression) {
this.hostUrl = hostUrl;
this.apiKey = apiKey;
this.traceId = traceId;
this.retryPolicyFactory = retryPolicyFactory;
this.responseCompression = responseCompression;

httpClient = OkHttpUtils.buildHttpClient(hostUrl, timeoutMillis);
this.httpClient = httpClient;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,21 @@ public void createRemaining(Config config) {
}
}
if (okHttpClient == null) {
String unixDomainSocket = SocketUtils.discoverApmSocket(config);
String namedPipe = config.getAgentNamedPipe();
String unixDomainSocket;
String namedPipe;
HttpUrl url;
if (!config.isCiVisibilityAgentlessEnabled()) {
unixDomainSocket = SocketUtils.discoverApmSocket(config);
namedPipe = config.getAgentNamedPipe();
url = agentUrl;
} else {
unixDomainSocket = null;
namedPipe = null;
url = null;
}
okHttpClient =
OkHttpUtils.buildHttpClient(
agentUrl, unixDomainSocket, namedPipe, getHttpClientTimeout(config));
url, unixDomainSocket, namedPipe, getHttpClientTimeout(config));
}
}

Expand Down
Loading

0 comments on commit 367dec7

Please sign in to comment.