Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b7d2ebb
feat(ci): restore benchmark PR comments + add reliability/chaos repor…
jbachorik Jun 10, 2026
932f745
ci: retrigger pipeline
jbachorik Jun 10, 2026
484e303
Merge branch 'main' into jb/ci-pr-comments
jbachorik Jun 11, 2026
47cdd81
ci: add GitHub→GitLab trigger for test:reliability and test:benchmark…
jbachorik Jun 11, 2026
37df588
ci: expose RUN_RELIABILITY/RUN_BENCHMARKS as documented GitLab pipeli…
jbachorik Jun 11, 2026
34c4cb4
fix(ci): restore unconditional benchmark runs on trigger-source pipel…
jbachorik Jun 11, 2026
082f273
ci: pre-fill RUN_RELIABILITY=true in GitLab UI; prepare.sh always wri…
jbachorik Jun 11, 2026
c79dcbe
ci: expose RUN_RELIABILITY as spec.inputs so it appears in GitLab New…
jbachorik Jun 11, 2026
4903383
ci: revert to variables+description for RUN_RELIABILITY (spec.inputs …
jbachorik Jun 11, 2026
2287bad
fix(ci): move trigger variables to job level (not inside trigger: block)
jbachorik Jun 11, 2026
ab202da
ci: default RUN_RELIABILITY to false
jbachorik Jun 11, 2026
0176e6c
fix(ci): replace alpine with approved registry image in reliability jobs
jbachorik Jun 11, 2026
0b3a1d7
fix(ci): replace bash-style default ${RUNTIME:-120} with plain value 120
jbachorik Jun 11, 2026
2b981d0
fix(ci): include crash signal and frame in chaos failure report
jbachorik Jun 11, 2026
378126e
fix(ci): use dd-octo-sts to clone benchmarking-platform (CI_JOB_TOKEN…
jbachorik Jun 11, 2026
549012a
fix(ci): clone benchmarking-platform without auth (public repo)
jbachorik Jun 12, 2026
b388ca5
fix(ci): post PR comments via GitHub API + dd-octo-sts token (drop pr…
jbachorik Jun 12, 2026
469aee5
fix(ci): run benchmarks automatically on push-source PR pipelines
jbachorik Jun 12, 2026
d15d987
fix(ci): harden PR-comment helper (trim/validate token, GH API header…
jbachorik Jun 12, 2026
a403026
fix(ci): grant pull_requests:write for PR comments; run benchmarks on…
jbachorik Jun 12, 2026
eea6401
ci: drop sts policy change (split into #595)
jbachorik Jun 12, 2026
660b162
Merge branch 'main' into jb/ci-pr-comments
jbachorik Jun 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ jobs:
outputs:
configurations: ${{ steps.compute.outputs.configurations }}
run_fuzz: ${{ steps.compute.outputs.run_fuzz }}
run_reliability: ${{ steps.compute.outputs.run_reliability }}
steps:
- name: Debounce label events
if: github.event.action == 'labeled'
Expand Down Expand Up @@ -161,8 +162,14 @@ jobs:
else
echo "run_fuzz=false" >> $GITHUB_OUTPUT
fi
if echo "$labels" | grep -Fq "test:reliability"; then
echo "run_reliability=true" >> $GITHUB_OUTPUT
else
echo "run_reliability=false" >> $GITHUB_OUTPUT
fi
else
echo "run_fuzz=false" >> $GITHUB_OUTPUT
echo "run_reliability=false" >> $GITHUB_OUTPUT
fi

configs="$configs]"
Expand Down
63 changes: 63 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ variables:
FORCE_BUILD:
value: ""
description: "Force build even if no new commits (any non-empty value)"
RUN_RELIABILITY:
value: "false"
description: "Run reliability and chaos tests. Set automatically when the test:reliability label is on the PR."
MAVEN_REPOSITORY_PROXY: "https://depot-read-api-java.us1.ddbuild.io/magicmirror/magicmirror/@current/"

default:
Expand Down Expand Up @@ -153,6 +156,66 @@ jdk-integration-test:
forward:
pipeline_variables: true

# Generates a child pipeline YAML for reliability/chaos tests when the PR
# carries the test:reliability label (RUN_RELIABILITY=true in build.env).
generate-reliability-child-pipeline:
stage: reliability
tags: ["arch:amd64"]
image: $PREPARE_IMAGE
needs:
- job: prepare:start
artifacts: true
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null'
when: never
- when: on_success
script:
- |
if [ "${RUN_RELIABILITY:-}" = "true" ]; then
echo "Label test:reliability detected — enabling reliability child pipeline"
cp .gitlab/reliability/pr-child.gitlab-ci.yml generated-reliability.yml
else
cat > generated-reliability.yml << 'NOOP'
skip-reliability:
image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:latest
tags: ["arch:amd64"]
script:
- echo "Label test:reliability not set — skipping"
rules:
- when: always
NOOP
fi
artifacts:
paths:
- generated-reliability.yml
expire_in: 1 day

run-reliability-tests:
stage: reliability
variables:
DDPROF_COMMIT_BRANCH: "$DDPROF_COMMIT_BRANCH"
DDPROF_COMMIT_SHA: "$DDPROF_COMMIT_SHA"
needs:
- job: generate-reliability-child-pipeline
artifacts: true
- job: prepare:start
artifacts: true
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null'
when: never
- when: on_success
trigger:
include:
- artifact: generated-reliability.yml
job: generate-reliability-child-pipeline
strategy: depend
forward:
pipeline_variables: true

include:
- local: .gitlab/common.yml
- local: .adms/python/gitlab.yaml
Expand Down
47 changes: 40 additions & 7 deletions .gitlab/benchmarks/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ variables:
rules:
- if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null'
when: never
- if: '$CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "pipeline"'
when: on_success
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$CI_PIPELINE_SOURCE == "web"'
when: manual
allow_failure: true
- if: '$CI_PIPELINE_SOURCE == "push"'
when: manual
# Run automatically and non-blocking on any other source (push/trigger/api/
# etc.) — mirrors the integration-test rules. The before_script CANCELLED
# gate skips branches with no open PR.
- when: on_success
allow_failure: true
script: |
# setup the env
Expand All @@ -36,8 +40,8 @@ variables:
if [ -z "${CANDIDATE_VERSION}" ]; then echo "Missing candidate version. Skipping."; exit 0; fi

# fetch the common platform scripts
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/"
git clone --branch dd-trace-go https://github.com/DataDog/benchmarking-platform ${PLATFORM_DIR}
git -c url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf="https://github.com/DataDog/" \
clone --branch dd-trace-go https://github.com/DataDog/benchmarking-platform ${PLATFORM_DIR}

# apply the specific step scripts
cp -r .gitlab/benchmarks/steps/* ${PLATFORM_DIR}/steps/
Expand All @@ -52,7 +56,6 @@ variables:
${PLATFORM_DIR}/steps/run-benchmarks.sh
${PLATFORM_DIR}/steps/analyze-results.sh
${PLATFORM_DIR}/steps/upload-results-to-s3.sh
${PLATFORM_DIR}/steps/post-pr-comment.sh
parallel:
matrix:
- RUN_MODE: ["cpu", "wall", "alloc", "memleak", "cpu,wall", "memleak,alloc", "cpu,wall,alloc,memleak"]
Expand All @@ -76,6 +79,36 @@ benchmarks-candidate-aarch64:
KUBERNETES_MEMORY_REQUEST: 200Gi
KUBERNETES_MEMORY_LIMIT: 200Gi

post-benchmarks-pr-comment:
extends: .retry-config
stage: benchmarks
tags: ["arch:arm64"]
image: registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1
id_tokens:
DDOCTOSTS_ID_TOKEN:
aud: dd-octo-sts
needs:
- job: prepare:start
artifacts: true
- job: benchmarks-candidate-amd64
artifacts: true
- job: benchmarks-candidate-aarch64
artifacts: true
Comment thread
jbachorik marked this conversation as resolved.
rules:
- if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null'
when: never
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
# Always run when the candidate jobs ran, regardless of source, so results
# are posted back to the PR.
- when: always
timeout: 5m
script:
- .gitlab/benchmarks/post-pr-comment.sh reports
allow_failure: true

publish-benchmark-gh-pages:
stage: benchmarks
tags: ["arch:arm64"]
Expand Down
47 changes: 47 additions & 0 deletions .gitlab/benchmarks/post-pr-comment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Post aggregated benchmark comparison results as a single PR comment.
#
# Expects all per-cell comparison-baseline-vs-candidate_*.md reports to be
# present under REPORTS_DIR (default: reports/).
#
# Required env:
# DDPROF_COMMIT_BRANCH – branch name used to locate the open PR
# Optional env:
# CI_PIPELINE_URL, DDPROF_COMMIT_SHA

set -euo pipefail

REPORTS_DIR="${1:-reports}"
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Aggregate all per-cell reports into a single comment body
SECTIONS=""
for md in "${REPORTS_DIR}"/comparison-baseline-vs-candidate_*.md; do
[ -f "${md}" ] || continue
label=$(basename "${md}" .md | sed 's/comparison-baseline-vs-candidate_//')
SECTIONS="${SECTIONS}
<details><summary>${label}</summary>

$(cat "${md}")

</details>
"
done

if [ -z "${SECTIONS}" ]; then
echo "No benchmark reports found under ${REPORTS_DIR} — skipping comment"
exit 0
fi

BODY_FILE=$(mktemp)
trap 'rm -f "${BODY_FILE}"' EXIT
cat > "${BODY_FILE}" <<EOF
## Benchmark Results

Pipeline: ${CI_PIPELINE_URL:-} Commit: \`${DDPROF_COMMIT_SHA:-unknown}\`

${SECTIONS}
EOF

"${HERE}/../scripts/upsert-github-pr-comment.sh" \
"benchmark-results" "${DDPROF_COMMIT_BRANCH:-}" "${BODY_FILE}"
13 changes: 0 additions & 13 deletions .gitlab/benchmarks/steps/post-pr-comment.sh

This file was deleted.

10 changes: 9 additions & 1 deletion .gitlab/reliability/chaos_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ RC=$?
echo "RC=$RC"

if [ $RC -ne 0 ]; then
echo "FAIL:Chaos harness crashed (RC=$RC)" >&2
CRASH_MSG="Chaos harness crashed (RC=${RC})"
HS_ERR="${HERE}/../../hs_err.log"
if [ -f "${HS_ERR}" ]; then
SIG=$(grep -m1 '^siginfo:' "${HS_ERR}" 2>/dev/null | tr -d '\n' | cut -c1-120)
FRAME=$(grep -m1 'libjavaProfiler\|AsyncProfiler' "${HS_ERR}" 2>/dev/null | sed 's/^[[:space:]]*//' | tr -d '\n' | cut -c1-120)
[ -n "${SIG}" ] && CRASH_MSG="${CRASH_MSG};${SIG}"
[ -n "${FRAME}" ] && CRASH_MSG="${CRASH_MSG};${FRAME}"
fi
echo "FAIL:${CRASH_MSG}" >&2
exit 1
fi
68 changes: 68 additions & 0 deletions .gitlab/reliability/post-pr-comment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
# Post aggregated reliability + chaos test results as a single PR comment.
#
# Reads REASON_* variables written to build.env by the reliability/chaos jobs
# and emits a ✅/❌ matrix with failure <details> blocks.
#
# Required env:
# DDPROF_COMMIT_BRANCH – branch name used to locate the open PR
# Optional env:
# CI_PIPELINE_URL

set -euo pipefail

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# ── Collect failures from REASON_* env vars ────────────────────────────────────
rel_fail=0; rel_failures=""
chaos_fail=0; chaos_failures=""

for key in $(compgen -v | grep -E '^REASON_.*X(jit|memory)$' | sort); do
reason="${!key}"
label="${key#REASON_}"
rel_fail=$((rel_fail + 1))
detail=$(printf '%s' "${reason//\`/}" | tr ';' '\n')
rel_failures="${rel_failures}
<details><summary>❌ ${label//_/ }</summary>

\`\`\`
${detail}
\`\`\`

</details>"
done

for key in $(compgen -v | grep -E '^REASON_.*Xchaos$' | sort); do
reason="${!key}"
label="${key#REASON_}"
chaos_fail=$((chaos_fail + 1))
detail=$(printf '%s' "${reason//\`/}" | tr ';' '\n')
chaos_failures="${chaos_failures}
<details><summary>❌ chaos: ${label//_/ }</summary>

\`\`\`
${detail}
\`\`\`

</details>"
done

# ── Assemble comment ────────────────────────────────────────────────────────────
total_fail=$((rel_fail + chaos_fail))
if [ "${total_fail}" -gt 0 ]; then
overall="❌ **${total_fail} failure(s) detected**"
else
overall="✅ **All reliability & chaos checks passed**"
fi

BODY_FILE=$(mktemp)
trap 'rm -f "${BODY_FILE}"' EXIT
cat > "${BODY_FILE}" <<EOF
## Reliability & Chaos Results

${overall} Pipeline: ${CI_PIPELINE_URL:-}
${rel_failures}${chaos_failures}
EOF

"${HERE}/../scripts/upsert-github-pr-comment.sh" \
"reliability-results" "${DDPROF_COMMIT_BRANCH:-}" "${BODY_FILE}"
Loading
Loading