Skip to content

Commit 04095ac

Browse files
authored
Merge branch 'master' into mhlidd/migrate_to_config_helper
2 parents a75b2e5 + 87124e5 commit 04095ac

File tree

12 files changed

+167
-113
lines changed

12 files changed

+167
-113
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ij_java_line_comment_add_space_on_reformat = false
2626
ij_java_line_comment_at_first_column = false
2727

2828

29-
[*.groovy]
29+
[{*.groovy,*.gradle}]
3030
ij_groovy_class_count_to_use_import_on_demand = 99
3131
ij_groovy_imports_layout = $*,|,*,|
3232
ij_groovy_names_count_to_use_import_on_demand = 99

.github/chainguard/self.update-system-tests.push.sts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
issuer: https://token.actions.githubusercontent.com
22

3-
subject: repo:DataDog/dd-trace-java:ref:refs/(heads/master|tags/v[0-9]+.[0-9]+.0)
3+
subject_pattern: repo:DataDog/dd-trace-java:ref:refs/(heads/master|tags/v[0-9]+.[0-9]+.0)
44

55
claim_pattern:
66
event_name: (push|workflow_dispatch)

.github/workflows/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ _Recovery:_ Manually trigger the action again.
107107

108108
### analyze-changes [🔗](analyze-changes.yaml)
109109

110-
_Trigger:_ When pushing commits to `master`.
110+
_Trigger:_ Every day or manually.
111111

112112
_Action:_
113113

114-
* Run [GitHub CodeQL](https://codeql.github.com/) action, upload result to GitHub security tab -- do not apply to pull request, only when pushing to `master`,
114+
* Run [GitHub CodeQL](https://codeql.github.com/) action, upload result to GitHub security tab -- do not apply to pull request, only to `master`,
115115
* Run [Trivy security scanner](https://github.com/aquasecurity/trivy) on built artifacts and upload result to GitHub security tab and Datadog Code Analysis.
116116

117117
_Notes:_ Results are sent on both production and staging environments.

.github/workflows/analyze-changes.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
name: Analyze changes
22

33
on:
4-
push:
5-
branches: [ master ]
6-
7-
# Cancel long-running jobs when a new commit is pushed
8-
concurrency:
9-
group: ${{ github.workflow }}-${{ github.ref }}
10-
cancel-in-progress: true
4+
schedule:
5+
- cron: "0 20 * * *"
6+
workflow_dispatch:
117

128
jobs:
139
codeql:
@@ -34,7 +30,7 @@ jobs:
3430
${{ runner.os }}-gradle-
3531
3632
- name: Initialize CodeQL
37-
uses: github/codeql-action/init@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
33+
uses: github/codeql-action/init@16140ae1a102900babc80a33c44059580f687047 # v4.30.9
3834
with:
3935
languages: 'java'
4036
build-mode: 'manual'
@@ -53,7 +49,7 @@ jobs:
5349
--build-cache --parallel --stacktrace --no-daemon --max-workers=4
5450
5551
- name: Perform CodeQL Analysis and upload results to GitHub Security tab
56-
uses: github/codeql-action/analyze@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
52+
uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 # v4.30.9
5753

5854
trivy:
5955
name: Analyze changes with Trivy
@@ -118,7 +114,7 @@ jobs:
118114
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db,public.ecr.aws/aquasecurity/trivy-java-db
119115

120116
- name: Upload Trivy scan results to GitHub Security tab
121-
uses: github/codeql-action/upload-sarif@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
117+
uses: github/codeql-action/upload-sarif@16140ae1a102900babc80a33c44059580f687047 # v4.30.9
122118
if: always()
123119
with:
124120
sarif_file: 'trivy-results.sarif'

.gitlab-ci.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,11 @@ default:
168168
- source .gitlab/gitlab-utils.sh
169169
# Akka token added to SSM from https://account.akka.io/token
170170
- export ORG_GRADLE_PROJECT_akkaRepositoryToken=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.akka_repo_token --with-decryption --query "Parameter.Value" --out text)
171+
- export ORG_GRADLE_PROJECT_mavenRepositoryProxy=$MAVEN_REPOSITORY_PROXY
172+
- export ORG_GRADLE_PROJECT_gradlePluginProxy=$GRADLE_PLUGIN_PROXY
171173
- mkdir -p .gradle
172-
- export GRADLE_USER_HOME=$(pwd)/.gradle
173-
- |
174-
# Don't put jvm args here as it will be picked up by child gradle processes used in tests
175-
cat << EOF > $GRADLE_USER_HOME/gradle.properties
176-
mavenRepositoryProxy=$MAVEN_REPOSITORY_PROXY
177-
gradlePluginProxy=$GRADLE_PLUGIN_PROXY
178-
EOF
179-
- |
180-
# replace maven central part by MAVEN_REPOSITORY_PROXY in .mvn/wrapper/maven-wrapper.properties
181-
sed -i "s|https://repo.maven.apache.org/maven2/|$MAVEN_REPOSITORY_PROXY|g" .mvn/wrapper/maven-wrapper.properties
174+
# replace maven central part by MAVEN_REPOSITORY_PROXY in .mvn/wrapper/maven-wrapper.properties
175+
- sed -i "s|https://repo.maven.apache.org/maven2/|$MAVEN_REPOSITORY_PROXY|g" .mvn/wrapper/maven-wrapper.properties
182176
- export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xms$GRADLE_MEM -Xmx$GRADLE_MEM -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
183177
- export GRADLE_ARGS=" --build-cache --stacktrace --no-daemon --parallel --max-workers=$GRADLE_WORKERS"
184178
- *normalize_node_index

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/coverage/report/JacocoCoverageProcessor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,11 @@ private long mergeAndUploadCoverageReport(IBundleCoverage coverageBundle) {
445445
continue;
446446
}
447447

448+
if (pathRelativeToIndexRoot == null) {
449+
LOGGER.debug("Could not resolve source for path {}", pathRelativeToSourceRoot);
450+
continue;
451+
}
452+
448453
LinesCoverage linesCoverage = getLinesCoverage(sourceFile);
449454
// backendCoverageData contains data for all modules in the repo,
450455
// but coverageBundle bundle only has source files that are relevant for the given module,

dd-java-agent/instrumentation/tomcat/tomcat-5.5/src/latestDepTest/groovy/TomcatServer.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class TomcatServer implements WebsocketServer {
6666
assert port > 0
6767
if (Config.get().isExperimentalPropagateProcessTagsEnabled()) {
6868
server.getEngine().setName("tomcat")
69-
def serverName = TraceUtils.normalizeTag(server.getEngine().getName())
69+
def serverName = TraceUtils.normalizeTagValue(server.getEngine().getName())
7070
assert ProcessTags.getTagsAsStringList().containsAll(["server.type:tomcat", "server.name:" + serverName])
7171
} else {
7272
assert ProcessTags.getTagsAsStringList() == null

gradle/java_no_deps.gradle

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,21 @@ tasks.withType(JavaExec).configureEach {
299299
}
300300
}
301301

302-
if (project.plugins.hasPlugin('com.gradleup.shadow')) {
302+
// For reproducible builds
303+
tasks.withType(AbstractArchiveTask).configureEach {
304+
preserveFileTimestamps = false
305+
reproducibleFileOrder = true
306+
}
307+
308+
project.pluginManager.withPlugin('com.gradleup.shadow') {
303309
// Remove the no-deps jar from the archives to prevent publication
304-
configurations.archives.with {
305-
artifacts.remove artifacts.find {
306-
if (it.hasProperty("delegate")) {
307-
it.delegate.archiveTask.is jar
308-
} else {
309-
it.archiveTask.is jar
310-
}
310+
// Also removes other distribution types (zip, tar etc.), only affects project in dd-smoke-tests
311+
configurations {
312+
named("archives") {
313+
outgoing.artifacts.clear()
314+
outgoing.artifact(project.tasks.named("shadowJar"))
311315
}
312316
}
313-
artifacts {
314-
archives(shadowJar)
315-
}
316317
}
317318

318319
if (project.hasProperty("removeJarVersionNumbers") && project.findProperty("removeJarVersionNumbers").asBoolean()) {

gradle/util.gradle

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
1-
tasks.register("artifacts") {
2-
group = "Help"
3-
description = "Displays the artifacts associated with each configuration of " + project
4-
doFirst {
1+
abstract class DisplayArtifactsTask extends DefaultTask {
2+
3+
@Option(option = "configuration", description = "Comma separated list of configuration name (defaults to 'archives,javadocElements,sourcesElements'). Use 'all' to display all configurations.")
4+
@Input
5+
@Optional
6+
abstract Property<String> getConfigurationName()
7+
8+
DisplayArtifactsTask() {
9+
group = "Help"
10+
description = "Displays the artifacts associated with each configuration of " + project
11+
configurationName.convention("archives,javadocElements,sourcesElements")
12+
}
13+
14+
@TaskAction
15+
void displayArtifacts() {
516
// This eager access is ok as it is during the task execution phase
6-
configurations.each { config ->
7-
println "${config}:"
8-
config.allArtifacts.getFiles().each { file ->
9-
println " " + file
17+
def builder = new StringBuilder()
18+
def targetConfig = configurationName.map { it.split(",").toList().toSet() }.orNull
19+
def configs = targetConfig.contains("all") ? project.configurations : project.configurations.matching { targetConfig.contains(it.name) }
20+
configs.each { config ->
21+
def outgoingFiles = config.outgoing.artifacts.getFiles()
22+
if (!outgoingFiles.isEmpty()) {
23+
builder.setLength(0)
24+
outgoingFiles.each { file ->
25+
def relPath = project.rootDir.toPath().relativize(file.toPath())
26+
builder.append(config).append(": ").append(relPath)
27+
}
28+
logger.quiet(builder.toString())
1029
}
11-
println ' '
1230
}
1331
}
1432
}
1533

34+
tasks.register("artifacts", DisplayArtifactsTask)
35+
1636
/** Find a random, reusable port. */
1737
ext.randomOpenPort = {
1838
->

internal-api/src/main/java/datadog/trace/api/ProcessTags.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static void calculate() {
146146
.map(
147147
entry ->
148148
UTF8BytesString.create(
149-
entry.getKey() + ":" + TraceUtils.normalizeTag(entry.getValue())));
149+
entry.getKey() + ":" + TraceUtils.normalizeTagValue(entry.getValue())));
150150
utf8ListForm = Collections.unmodifiableList(tagStream.collect(Collectors.toList()));
151151
stringListForm =
152152
Collections.unmodifiableList(

0 commit comments

Comments
 (0)