Skip to content

ci: run benchmarks only for the top of a PR stack - #822

Merged
jbachorik merged 2 commits into
mainfrom
fix/benchmarks_pr_stack
Sep 28, 2026
Merged

jbachorik merged 2 commits into
mainfrom
fix/benchmarks_pr_stack

Conversation

@jbachorik

@jbachorik jbachorik commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?:

Runs the Benchmarking-Platform pipeline only for the top branch of a PR stack instead of for every pushed branch. A branch is considered mid-stack when an open PR uses it as base branch (stacked PRs chain head -> base); main always runs. The decision lives in .gitlab/benchmarks/check-stack-top.sh and gates the existing benchmarks child pipeline via the same generated-YAML pattern the reliability pipeline already uses.

Motivation:
A stack of N PRs currently triggers N identical BP benchmark pipelines per push. Only the top of the stack needs benchmark coverage.

Additional Notes:

  • Fail-open: any GitHub API/auth/parsing error enables benchmarks so an outage can never silently disable coverage; the failure reason is surfaced in the job log.
  • CANDIDATE_VERSION/BASELINE_VERSION are redeclared in run-benchmarks variables: (trigger-job variables, documented forwarding path) and the child pipeline has a fail-fast guard, so BP never consumes empty versions.
  • The benchmarks child pipeline is independently retryable in the GitLab UI; its guard job carries the CANCELLED rule so a manual retry cannot bypass parent-level gating.
  • Unit tests for the decision script (fake curl/jq, 15 cases) are wired into shell-unit-tests.

How to test the change?:

  • bash .gitlab/scripts/tests/test_check_stack_top.sh (also runs in CI via shell-unit-tests).
  • Live behavior verified against the GitHub API: jb/rc-7-tooling (PR Reference-chains design and architecture docs #802 stacked on it) -> skip; jb/rc-8-docs (stack top) -> run; main -> run.
  • On a real pipeline: a push to a mid-stack branch must not start the BP pipeline; a push to the stack top or main must start it with non-empty versions (the child guard fails fast otherwise).

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a security review (run the dd:platform-security-review skill, or file a request via the PSEC review form).
    bewaire also runs automatically on every PR.
  • This PR doesn't touch any of that.
  • JIRA: PROF-16071

Stacked PRs chain head -> base, so a branch with an open PR using it as
base is below another PR in the stack and gets no Benchmarking-Platform
pipeline. The check runs in generate-benchmarks-child-pipeline, which
emits either the real child pipeline (BP bridge + version-inputs guard)
or a noop skip child; run-benchmarks triggers it with strategy: depend.

- check-stack-top.sh: GitHub PR API lookup, fail-open on any error,
  token passed via 0600 header file (never argv), HTTP status surfaced
- CANDIDATE_VERSION/BASELINE_VERSION redeclared in run-benchmarks'
  variables block so they reach the child as trigger-job variables;
  child guard fails fast on empty versions
- shared .benchmarks-skip-rules anchor; deploy-artifact need optional
  (release branches); PARENT_COMMIT_BRANCH falls back to CI_COMMIT_REF_NAME
- generate job auto-runs in web pipelines (run-benchmarks stays manual)
- unit tests for the decision script wired into shell-unit-tests
@jbachorik jbachorik added the AI label Sep 25, 2026
@dd-octo-sts

dd-octo-sts Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 c3576d3c

@dd-octo-sts

dd-octo-sts Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #36137762283 | Commit: 8b84b77 | Duration: 15m 14s (longest job)

✅ All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - ✅ - -
8-ibm - ✅ - -
8-j9 ✅ ✅ - -
8-librca - - ✅ ✅
8-orcl - ✅ - -
11 - ✅ - -
11-j9 ✅ ✅ - -
11-librca - - ✅ ✅
17 ✅ ✅ - -
17-graal ✅ ✅ - -
17-j9 ✅ ✅ - -
17-librca - - ✅ ✅
21 ✅ ✅ - -
21-graal ✅ ✅ - -
21-librca - - ✅ ✅
25 ✅ ✅ - -
25-graal ✅ ✅ - -
25-librca - - ✅ ✅

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-09-25 13:13:49 UTC

@jbachorik
jbachorik marked this pull request as ready for review September 25, 2026 12:21
@jbachorik
jbachorik requested a review from a team as a code owner September 25, 2026 12:21
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T12:23:55.961756Z a8548a0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a8548a0e83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .gitlab/benchmarks/child.gitlab-ci.yml

@datadog-datadog-us1-prod datadog-datadog-us1-prod Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

The most critical issue is that moving benchmarks-trigger into a child pipeline breaks the report downloader, which searches only the parent pipeline and silently leaves GitHub Pages stale. Separately, the Bash :- fallback syntax used in a GitLab trigger variable is not evaluated by GitLab, causing incorrect branch values to be passed downstream.

Open Bits AI session

🤖 Bits Code Review · Commit a8548a0 · @DataDog review to ask questions

Comment thread .gitlab/benchmarks/.gitlab-ci.yml
Comment thread .gitlab/benchmarks/.gitlab-ci.yml Outdated
@jbachorik

Copy link
Copy Markdown
Collaborator Author

Fixed in c3576d3 (addressing general review comment).

1 similar comment
@jbachorik

Copy link
Copy Markdown
Collaborator Author

Fixed in c3576d3 (addressing general review comment).

@jbachorik
jbachorik merged commit 3b58afd into main Sep 28, 2026
112 checks passed
@jbachorik
jbachorik deleted the fix/benchmarks_pr_stack branch September 28, 2026 10:20
@github-actions github-actions Bot added this to the 1.52.0 milestone Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant