Skip to content

Commit 1b6bc24

Browse files
authored
Merge branch 'master' into sarahchen6/move-macrobenchmarks
2 parents c72ab1f + 0f79569 commit 1b6bc24

File tree

45 files changed

+11984
-2495
lines changed

Some content is hidden

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

45 files changed

+11984
-2495
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
issuer: https://token.actions.githubusercontent.com
22

3-
subject_pattern: repo:DataDog/dd-trace-java:ref:refs/heads/*
3+
subject_pattern: repo:DataDog/dd-trace-java:ref:refs/heads/(master|test/v.+)
44

55
claim_pattern:
6-
event_name: (push|workflow_dispatch)
7-
ref: refs/heads/*
8-
job_workflow_ref: DataDog/dd-trace-java/\.github/workflows/pin-system-tests\.yaml@refs/heads/master
6+
event_name: (create|workflow_dispatch)
7+
ref: refs/heads/(master|test/v.+)
8+
job_workflow_ref: DataDog/dd-trace-java/\.github/workflows/pin-system-tests\.yaml@refs/heads/(master|test/v.+)
99

1010
permissions:
1111
contents: write
1212
pull_requests: write
13+
workflows: write
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Pin system tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-branch-name:
7+
description: 'The minor release branch name (e.g. release/v1.54.x)'
8+
required: true
9+
type: string
10+
# run workflow when a release branch is created
11+
create:
12+
13+
jobs:
14+
pin-system-tests:
15+
name: "Pin system tests"
16+
# CHANGE BACK TO release/v*
17+
if: github.event_name != 'create' || startsWith(github.ref, 'refs/heads/test/v')
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write # may not be needed
21+
id-token: write # Required for OIDC token federation
22+
steps:
23+
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
24+
id: octo-sts
25+
with:
26+
scope: DataDog/dd-trace-java
27+
policy: self.pin-system-tests.create-pr
28+
29+
- name: Define base branch
30+
id: define-base-branch
31+
run: |
32+
if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then
33+
BASE_BRANCH=${{ github.event.inputs.release-branch-name }}
34+
else
35+
BASE_BRANCH=${GITHUB_REF#refs/heads/}
36+
fi
37+
echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT
38+
39+
- name: Checkout the repository
40+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
41+
with:
42+
ref: ${{ steps.define-base-branch.outputs.base_branch }}
43+
44+
- name: Get latest commit SHA of base branch
45+
id: get-latest-commit-sha
46+
run: |
47+
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
48+
49+
- name: Define branch name
50+
id: define-branch
51+
run: echo "branch=ci/pin-system-tests-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
52+
53+
- name: Check if branch already exists
54+
id: check-branch
55+
run: |
56+
BRANCH=${{ steps.define-branch.outputs.branch }}
57+
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
58+
echo "creating_new_branch=false" >> "$GITHUB_OUTPUT"
59+
echo "Branch $BRANCH already exists - please delete it and re-run the workflow."
60+
else
61+
echo "creating_new_branch=true" >> "$GITHUB_OUTPUT"
62+
echo "Branch $BRANCH does not exist - creating it now"
63+
fi
64+
65+
- name: Update system-tests references to latest commit SHA on main
66+
run: ./tooling/update_system_test_reference.sh
67+
68+
- name: Check if changes should be committed
69+
id: check-changes
70+
run: |
71+
if [[ -z "$(git status -s)" ]]; then
72+
echo "No changes to commit, exiting."
73+
echo "commit_changes=false" >> "$GITHUB_OUTPUT"
74+
else
75+
echo "commit_changes=true" >> "$GITHUB_OUTPUT"
76+
echo "Changes to commit:"
77+
git status -s
78+
fi
79+
80+
- name: Commit changes
81+
if: steps.check-changes.outputs.commit_changes == 'true'
82+
id: create-commit
83+
run: |
84+
git config user.name "github-actions[bot]"
85+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
86+
git commit -m "chore: Pin system-tests for release branch" .github/workflows/run-system-tests.yaml
87+
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
88+
89+
- name: Push changes
90+
uses: DataDog/commit-headless@5a0f3876e0fbdd3a86b3e008acf4ec562db59eee # action/v2.0.1
91+
if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true'
92+
with:
93+
token: "${{ steps.octo-sts.outputs.token }}"
94+
branch: "${{ steps.define-branch.outputs.branch }}"
95+
head-sha: "${{ steps.get-latest-commit-sha.outputs.sha }}"
96+
create-branch: true
97+
command: push
98+
commits: "${{ steps.create-commit.outputs.commit }}"
99+
100+
- name: Create pull request
101+
if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true'
102+
env:
103+
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
104+
# REMOVE DRAFT
105+
run: |
106+
gh pr create --title "Pin system tests for release branch" \
107+
--base ${{ steps.define-base-branch.outputs.base_branch }} \
108+
--head ${{ steps.define-branch.outputs.branch }} \
109+
--label "tag: dependencies" \
110+
--label "tag: no release notes" \
111+
--body "This PR pins the system-tests reference for the release branch." \
112+
--draft

.gitlab-ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,8 @@ muzzle-dep-report:
545545
needs: [ build_tests ]
546546
stage: tests
547547
variables:
548-
KUBERNETES_MEMORY_REQUEST: 17Gi
549-
KUBERNETES_MEMORY_LIMIT: 17Gi
548+
KUBERNETES_MEMORY_REQUEST: 20Gi
549+
KUBERNETES_MEMORY_LIMIT: 20Gi
550550
KUBERNETES_CPU_REQUEST: 10
551551
GRADLE_WORKERS: 4
552552
GRADLE_MEM: 3G
@@ -731,7 +731,7 @@ test_smoke:
731731
GRADLE_PARAMS: "-PskipFlakyTests"
732732
CACHE_TYPE: "smoke"
733733
parallel:
734-
matrix: *test_matrix_6
734+
matrix: *test_matrix_8
735735

736736
test_ssi_smoke:
737737
extends: .test_job
@@ -742,7 +742,7 @@ test_ssi_smoke:
742742
DD_INJECT_FORCE: "true"
743743
DD_INJECTION_ENABLED: "tracer"
744744
parallel:
745-
matrix: *test_matrix_6
745+
matrix: *test_matrix_8
746746

747747
test_smoke_graalvm:
748748
extends: .test_job
@@ -1008,7 +1008,7 @@ validate_supported_configurations_v2_local_file:
10081008
extends: .validate_supported_configurations_v2_local_file
10091009
variables:
10101010
LOCAL_JSON_PATH: "metadata/supported-configurations.json"
1011-
BACKFILLED: "false"
1011+
BACKFILLED: "true"
10121012

10131013
update_central_configurations_version_range_v2:
10141014
extends: .update_central_configurations_version_range_v2

.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/04f6a88e3db67cb88821632d138a2a5c3105ba59760bd3dfc60b54733501ecc3/one-pipeline.yml
4+
- remote: https://gitlab-templates.ddbuild.io/libdatadog/one-pipeline/ca/58b2e8d06c714848c8577c8ac9b460b7413823d75ee96d068ebff547d109f5d0/one-pipeline.yml

buildSrc/src/main/kotlin/datadog/gradle/plugin/config/ParseV2SupportedConfigurationsTask.kt

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package datadog.gradle.plugin.config
22

33
import org.gradle.api.DefaultTask
4-
import org.gradle.kotlin.dsl.property
54
import org.gradle.api.model.ObjectFactory
65
import org.gradle.api.tasks.Input
76
import org.gradle.api.tasks.InputFile
@@ -12,6 +11,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
1211
import org.gradle.api.tasks.CacheableTask
1312
import org.gradle.api.tasks.PathSensitive
1413
import org.gradle.api.tasks.PathSensitivity
14+
import org.gradle.kotlin.dsl.property
1515
import java.io.File
1616
import java.io.FileInputStream
1717
import java.io.PrintWriter
@@ -131,11 +131,29 @@ abstract class ParseV2SupportedConfigurationsTask @Inject constructor(
131131
out.println(" public static final Map<String, String> REVERSE_PROPERTY_KEYS_MAP;")
132132
out.println()
133133
out.println(" static {")
134+
out.println(" SUPPORTED = initSupported();")
135+
out.println(" ALIASES = initAliases();")
136+
out.println(" ALIAS_MAPPING = initAliasMapping();")
137+
out.println(" DEPRECATED = initDeprecated();")
138+
out.println(" REVERSE_PROPERTY_KEYS_MAP = initReversePropertyKeysMap();")
139+
out.println(" }")
134140
out.println()
135141

136-
// SUPPORTED
142+
// initSupported() - split into two helper functions to avoid "code too large" error
143+
out.println(" private static Map<String, List<SupportedConfiguration>> initSupported() {")
137144
out.println(" Map<String, List<SupportedConfiguration>> supportedMap = new HashMap<>();")
138-
for ((key, configList) in supported.toSortedMap()) {
145+
out.println(" initSupported1(supportedMap);")
146+
out.println(" initSupported2(supportedMap);")
147+
out.println(" return Collections.unmodifiableMap(supportedMap);")
148+
out.println(" }")
149+
out.println()
150+
151+
val sortedSupported = supported.toSortedMap().entries.toList()
152+
val midpoint = sortedSupported.size / 2
153+
154+
// initSupported1() - first half
155+
out.println(" private static void initSupported1(Map<String, List<SupportedConfiguration>> supportedMap) {")
156+
for ((key, configList) in sortedSupported.take(midpoint)) {
139157
out.print(" supportedMap.put(\"${esc(key)}\", Collections.unmodifiableList(Arrays.asList(")
140158
val configIter = configList.iterator()
141159
while (configIter.hasNext()) {
@@ -151,11 +169,33 @@ abstract class ParseV2SupportedConfigurationsTask @Inject constructor(
151169
}
152170
out.println(")));")
153171
}
154-
out.println(" SUPPORTED = Collections.unmodifiableMap(supportedMap);")
172+
out.println(" }")
155173
out.println()
156174

157-
// ALIASES
158-
out.println(" // Note: This top-level alias mapping will be deprecated once Config Registry is mature enough to understand which version of a config a customer is using")
175+
// initSupported2() - second half
176+
out.println(" private static void initSupported2(Map<String, List<SupportedConfiguration>> supportedMap) {")
177+
for ((key, configList) in sortedSupported.drop(midpoint)) {
178+
out.print(" supportedMap.put(\"${esc(key)}\", Collections.unmodifiableList(Arrays.asList(")
179+
val configIter = configList.iterator()
180+
while (configIter.hasNext()) {
181+
val config = configIter.next()
182+
out.print("new SupportedConfiguration(")
183+
out.print("${escNullableString(config.version)}, ")
184+
out.print("${escNullableString(config.type)}, ")
185+
out.print("${escNullableString(config.default)}, ")
186+
out.print("Arrays.asList(${quoteList(config.aliases)}), ")
187+
out.print("Arrays.asList(${quoteList(config.propertyKeys)})")
188+
out.print(")")
189+
if (configIter.hasNext()) out.print(", ")
190+
}
191+
out.println(")));")
192+
}
193+
out.println(" }")
194+
out.println()
195+
196+
// initAliases()
197+
out.println(" // Note: This top-level alias mapping will be deprecated once Config Registry is mature enough to understand which version of a config a customer is using")
198+
out.println(" private static Map<String, List<String>> initAliases() {")
159199
out.println(" Map<String, List<String>> aliasesMap = new HashMap<>();")
160200
for ((canonical, list) in aliases.toSortedMap()) {
161201
out.printf(
@@ -164,33 +204,37 @@ abstract class ParseV2SupportedConfigurationsTask @Inject constructor(
164204
quoteList(list)
165205
)
166206
}
167-
out.println(" ALIASES = Collections.unmodifiableMap(aliasesMap);")
207+
out.println(" return Collections.unmodifiableMap(aliasesMap);")
208+
out.println(" }")
168209
out.println()
169210

170-
// ALIAS_MAPPING
211+
// initAliasMapping()
212+
out.println(" private static Map<String, String> initAliasMapping() {")
171213
out.println(" Map<String, String> aliasMappingMap = new HashMap<>();")
172214
for ((alias, target) in aliasMapping.toSortedMap()) {
173215
out.printf(" aliasMappingMap.put(\"%s\", \"%s\");\n", esc(alias), esc(target))
174216
}
175-
out.println(" ALIAS_MAPPING = Collections.unmodifiableMap(aliasMappingMap);")
217+
out.println(" return Collections.unmodifiableMap(aliasMappingMap);")
218+
out.println(" }")
176219
out.println()
177220

178-
// DEPRECATED
221+
// initDeprecated()
222+
out.println(" private static Map<String, String> initDeprecated() {")
179223
out.println(" Map<String, String> deprecatedMap = new HashMap<>();")
180224
for ((oldKey, note) in deprecated.toSortedMap()) {
181225
out.printf(" deprecatedMap.put(\"%s\", \"%s\");\n", esc(oldKey), esc(note))
182226
}
183-
out.println(" DEPRECATED = Collections.unmodifiableMap(deprecatedMap);")
227+
out.println(" return Collections.unmodifiableMap(deprecatedMap);")
228+
out.println(" }")
184229
out.println()
185230

186-
// REVERSE_PROPERTY_KEYS_MAP
231+
// initReversePropertyKeysMap()
232+
out.println(" private static Map<String, String> initReversePropertyKeysMap() {")
187233
out.println(" Map<String, String> reversePropertyKeysMapping = new HashMap<>();")
188234
for ((propertyKey, config) in reversePropertyKeysMap.toSortedMap()) {
189235
out.printf(" reversePropertyKeysMapping.put(\"%s\", \"%s\");\n", esc(propertyKey), esc(config))
190236
}
191-
out.println(" REVERSE_PROPERTY_KEYS_MAP = Collections.unmodifiableMap(reversePropertyKeysMapping);")
192-
out.println()
193-
237+
out.println(" return Collections.unmodifiableMap(reversePropertyKeysMapping);")
194238
out.println(" }")
195239
out.println("}")
196240
}

buildSrc/src/main/kotlin/datadog/gradle/plugin/config/SupportedConfigPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class SupportedConfigPlugin : Plugin<Project> {
1313

1414
private fun generateSupportedConfigurations(targetProject: Project, extension: SupportedTracerConfigurations) {
1515
val generateTask =
16-
targetProject.tasks.register("generateSupportedConfigurations", ParseSupportedConfigurationsTask::class.java) {
16+
targetProject.tasks.register("generateSupportedConfigurations", ParseV2SupportedConfigurationsTask::class.java) {
1717
jsonFile.set(extension.jsonFile)
1818
destinationDirectory.set(extension.destinationDirectory)
1919
className.set(extension.className)

0 commit comments

Comments
 (0)