Skip to content

Commit fc14d7c

Browse files
authored
Merge branch 'main' into prof-15098-context-by-id
2 parents 3d36764 + 93adc6b commit fc14d7c

13 files changed

Lines changed: 1465 additions & 51 deletions

File tree

.gitlab-ci.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ variables:
88
FORCE_BUILD:
99
value: ""
1010
description: "Force build even if no new commits (any non-empty value)"
11+
RUN_RELIABILITY:
12+
value: "false"
13+
description: "Run reliability and chaos tests. Set automatically when the test:reliability label is on the PR."
1114
MAVEN_REPOSITORY_PROXY: "https://depot-read-api-java.us1.ddbuild.io/magicmirror/magicmirror/@current/"
1215

1316
default:
@@ -153,6 +156,66 @@ jdk-integration-test:
153156
forward:
154157
pipeline_variables: true
155158

159+
# Generates a child pipeline YAML for reliability/chaos tests when the PR
160+
# carries the test:reliability label (RUN_RELIABILITY=true in build.env).
161+
generate-reliability-child-pipeline:
162+
stage: reliability
163+
tags: ["arch:amd64"]
164+
image: $PREPARE_IMAGE
165+
needs:
166+
- job: prepare:start
167+
artifacts: true
168+
rules:
169+
- if: '$CI_PIPELINE_SOURCE == "schedule"'
170+
when: never
171+
- if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null'
172+
when: never
173+
- when: on_success
174+
script:
175+
- |
176+
if [ "${RUN_RELIABILITY:-}" = "true" ]; then
177+
echo "Label test:reliability detected — enabling reliability child pipeline"
178+
cp .gitlab/reliability/pr-child.gitlab-ci.yml generated-reliability.yml
179+
else
180+
cat > generated-reliability.yml << 'NOOP'
181+
skip-reliability:
182+
image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:latest
183+
tags: ["arch:amd64"]
184+
script:
185+
- echo "Label test:reliability not set — skipping"
186+
rules:
187+
- when: always
188+
NOOP
189+
fi
190+
artifacts:
191+
paths:
192+
- generated-reliability.yml
193+
expire_in: 1 day
194+
195+
run-reliability-tests:
196+
stage: reliability
197+
variables:
198+
DDPROF_COMMIT_BRANCH: "$DDPROF_COMMIT_BRANCH"
199+
DDPROF_COMMIT_SHA: "$DDPROF_COMMIT_SHA"
200+
needs:
201+
- job: generate-reliability-child-pipeline
202+
artifacts: true
203+
- job: prepare:start
204+
artifacts: true
205+
rules:
206+
- if: '$CI_PIPELINE_SOURCE == "schedule"'
207+
when: never
208+
- if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null'
209+
when: never
210+
- when: on_success
211+
trigger:
212+
include:
213+
- artifact: generated-reliability.yml
214+
job: generate-reliability-child-pipeline
215+
strategy: depend
216+
forward:
217+
pipeline_variables: true
218+
156219
include:
157220
- local: .gitlab/common.yml
158221
- local: .adms/python/gitlab.yaml

.gitlab/benchmarks/.gitlab-ci.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ variables:
1717
rules:
1818
- if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null'
1919
when: never
20-
- if: '$CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "pipeline"'
21-
when: on_success
20+
- if: '$CI_PIPELINE_SOURCE == "schedule"'
21+
when: never
22+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
23+
when: never
2224
- if: '$CI_PIPELINE_SOURCE == "web"'
2325
when: manual
2426
allow_failure: true
25-
- if: '$CI_PIPELINE_SOURCE == "push"'
26-
when: manual
27+
# Run automatically and non-blocking on any other source (push/trigger/api/
28+
# etc.) — mirrors the integration-test rules. The before_script CANCELLED
29+
# gate skips branches with no open PR.
30+
- when: on_success
2731
allow_failure: true
2832
script: |
2933
# setup the env
@@ -36,8 +40,8 @@ variables:
3640
if [ -z "${CANDIDATE_VERSION}" ]; then echo "Missing candidate version. Skipping."; exit 0; fi
3741
3842
# fetch the common platform scripts
39-
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/"
40-
git clone --branch dd-trace-go https://github.com/DataDog/benchmarking-platform ${PLATFORM_DIR}
43+
git -c url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf="https://github.com/DataDog/" \
44+
clone --branch dd-trace-go https://github.com/DataDog/benchmarking-platform ${PLATFORM_DIR}
4145
4246
# apply the specific step scripts
4347
cp -r .gitlab/benchmarks/steps/* ${PLATFORM_DIR}/steps/
@@ -52,7 +56,6 @@ variables:
5256
${PLATFORM_DIR}/steps/run-benchmarks.sh
5357
${PLATFORM_DIR}/steps/analyze-results.sh
5458
${PLATFORM_DIR}/steps/upload-results-to-s3.sh
55-
${PLATFORM_DIR}/steps/post-pr-comment.sh
5659
parallel:
5760
matrix:
5861
- RUN_MODE: ["cpu", "wall", "alloc", "memleak", "cpu,wall", "memleak,alloc", "cpu,wall,alloc,memleak"]
@@ -76,6 +79,36 @@ benchmarks-candidate-aarch64:
7679
KUBERNETES_MEMORY_REQUEST: 200Gi
7780
KUBERNETES_MEMORY_LIMIT: 200Gi
7881

82+
post-benchmarks-pr-comment:
83+
extends: .retry-config
84+
stage: benchmarks
85+
tags: ["arch:arm64"]
86+
image: registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1
87+
id_tokens:
88+
DDOCTOSTS_ID_TOKEN:
89+
aud: dd-octo-sts
90+
needs:
91+
- job: prepare:start
92+
artifacts: true
93+
- job: benchmarks-candidate-amd64
94+
artifacts: true
95+
- job: benchmarks-candidate-aarch64
96+
artifacts: true
97+
rules:
98+
- if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null'
99+
when: never
100+
- if: '$CI_PIPELINE_SOURCE == "schedule"'
101+
when: never
102+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
103+
when: never
104+
# Always run when the candidate jobs ran, regardless of source, so results
105+
# are posted back to the PR.
106+
- when: always
107+
timeout: 5m
108+
script:
109+
- .gitlab/benchmarks/post-pr-comment.sh reports
110+
allow_failure: true
111+
79112
publish-benchmark-gh-pages:
80113
stage: benchmarks
81114
tags: ["arch:arm64"]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
# Post aggregated benchmark comparison results as a single PR comment.
3+
#
4+
# Expects all per-cell comparison-baseline-vs-candidate_*.md reports to be
5+
# present under REPORTS_DIR (default: reports/).
6+
#
7+
# Required env:
8+
# DDPROF_COMMIT_BRANCH – branch name used to locate the open PR
9+
# Optional env:
10+
# CI_PIPELINE_URL, DDPROF_COMMIT_SHA
11+
12+
set -euo pipefail
13+
14+
REPORTS_DIR="${1:-reports}"
15+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16+
17+
# Aggregate all per-cell reports into a single comment body
18+
SECTIONS=""
19+
for md in "${REPORTS_DIR}"/comparison-baseline-vs-candidate_*.md; do
20+
[ -f "${md}" ] || continue
21+
label=$(basename "${md}" .md | sed 's/comparison-baseline-vs-candidate_//')
22+
SECTIONS="${SECTIONS}
23+
<details><summary>${label}</summary>
24+
25+
$(cat "${md}")
26+
27+
</details>
28+
"
29+
done
30+
31+
if [ -z "${SECTIONS}" ]; then
32+
echo "No benchmark reports found under ${REPORTS_DIR} — skipping comment"
33+
exit 0
34+
fi
35+
36+
BODY_FILE=$(mktemp)
37+
trap 'rm -f "${BODY_FILE}"' EXIT
38+
cat > "${BODY_FILE}" <<EOF
39+
## Benchmark Results
40+
41+
Pipeline: ${CI_PIPELINE_URL:-} Commit: \`${DDPROF_COMMIT_SHA:-unknown}\`
42+
43+
${SECTIONS}
44+
EOF
45+
46+
"${HERE}/../scripts/upsert-github-pr-comment.sh" \
47+
"benchmark-results" "${DDPROF_COMMIT_BRANCH:-}" "${BODY_FILE}"

.gitlab/benchmarks/steps/post-pr-comment.sh

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

.gitlab/reliability/chaos_check.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ RC=$?
160160
echo "RC=$RC"
161161

162162
if [ $RC -ne 0 ]; then
163-
echo "FAIL:Chaos harness crashed (RC=$RC)" >&2
163+
CRASH_MSG="Chaos harness crashed (RC=${RC})"
164+
HS_ERR="${HERE}/../../hs_err.log"
165+
if [ -f "${HS_ERR}" ]; then
166+
SIG=$(grep -m1 '^siginfo:' "${HS_ERR}" 2>/dev/null | tr -d '\n' | cut -c1-120)
167+
FRAME=$(grep -m1 'libjavaProfiler\|AsyncProfiler' "${HS_ERR}" 2>/dev/null | sed 's/^[[:space:]]*//' | tr -d '\n' | cut -c1-120)
168+
[ -n "${SIG}" ] && CRASH_MSG="${CRASH_MSG};${SIG}"
169+
[ -n "${FRAME}" ] && CRASH_MSG="${CRASH_MSG};${FRAME}"
170+
fi
171+
echo "FAIL:${CRASH_MSG}" >&2
164172
exit 1
165173
fi
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
# Post aggregated reliability + chaos test results as a single PR comment.
3+
#
4+
# Reads REASON_* variables written to build.env by the reliability/chaos jobs
5+
# and emits a ✅/❌ matrix with failure <details> blocks.
6+
#
7+
# Required env:
8+
# DDPROF_COMMIT_BRANCH – branch name used to locate the open PR
9+
# Optional env:
10+
# CI_PIPELINE_URL
11+
12+
set -euo pipefail
13+
14+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15+
16+
# ── Collect failures from REASON_* env vars ────────────────────────────────────
17+
rel_fail=0; rel_failures=""
18+
chaos_fail=0; chaos_failures=""
19+
20+
for key in $(compgen -v | grep -E '^REASON_.*X(jit|memory)$' | sort); do
21+
reason="${!key}"
22+
label="${key#REASON_}"
23+
rel_fail=$((rel_fail + 1))
24+
detail=$(printf '%s' "${reason//\`/}" | tr ';' '\n')
25+
rel_failures="${rel_failures}
26+
<details><summary>❌ ${label//_/ }</summary>
27+
28+
\`\`\`
29+
${detail}
30+
\`\`\`
31+
32+
</details>"
33+
done
34+
35+
for key in $(compgen -v | grep -E '^REASON_.*Xchaos$' | sort); do
36+
reason="${!key}"
37+
label="${key#REASON_}"
38+
chaos_fail=$((chaos_fail + 1))
39+
detail=$(printf '%s' "${reason//\`/}" | tr ';' '\n')
40+
chaos_failures="${chaos_failures}
41+
<details><summary>❌ chaos: ${label//_/ }</summary>
42+
43+
\`\`\`
44+
${detail}
45+
\`\`\`
46+
47+
</details>"
48+
done
49+
50+
# ── Assemble comment ────────────────────────────────────────────────────────────
51+
total_fail=$((rel_fail + chaos_fail))
52+
if [ "${total_fail}" -gt 0 ]; then
53+
overall="❌ **${total_fail} failure(s) detected**"
54+
else
55+
overall="✅ **All reliability & chaos checks passed**"
56+
fi
57+
58+
BODY_FILE=$(mktemp)
59+
trap 'rm -f "${BODY_FILE}"' EXIT
60+
cat > "${BODY_FILE}" <<EOF
61+
## Reliability & Chaos Results
62+
63+
${overall} Pipeline: ${CI_PIPELINE_URL:-}
64+
${rel_failures}${chaos_failures}
65+
EOF
66+
67+
"${HERE}/../scripts/upsert-github-pr-comment.sh" \
68+
"reliability-results" "${DDPROF_COMMIT_BRANCH:-}" "${BODY_FILE}"

0 commit comments

Comments
 (0)