Skip to content

Skip CLI E2E on draft PRs - #4700

Draft
mokagio wants to merge 1 commit into
trunkfrom
ainfra-3003-skip-studio-cli-e2e-on-draft-prs-keeping-the-check-reporting
Draft

Skip CLI E2E on draft PRs#4700
mokagio wants to merge 1 commit into
trunkfrom
ainfra-3003-skip-studio-cli-e2e-on-draft-prs-keeping-the-check-reporting

Conversation

@mokagio

@mokagio mokagio commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code wrote the change and ran the verification below. I reviewed the diff.

Claude Code also noticed the issue this PR addresses, when prompted by me to research opportunities to improve the DX of the tools Apps Infra provides to our "users", CI being a core one of them.

Proposed Changes

E2E Tests skips draft PRs through an if: guard on the group. CLI E2E Tests cannot use one — a required status check that never reports leaves the PR waiting on it — so it runs on 99% of builds, costing 859 agent-hours a month across mac, windows and linux.

The repo already solved this the other way round: run-cli-e2e-tests.sh exits 0 early for doc-only PRs, and the check still reports green in seconds. This extends that early exit to drafts. Expected saving is roughly a third of those hours, and up to 20 minutes of wait on every draft PR (CLI E2E Tests on windows is 20.0 min p50).

Testing Instructions

Steps the AI took

BUILDKITE_PULL_REQUEST_DRAFT is exported only when the PR is a draft, which is what makes the :-false default load-bearing. Confirmed against the real job environments of two studio builds:

Build PR state BUILDKITE_PULL_REQUEST_DRAFT
21213 draft 'true'
21397 not a draft absent

I also checked that the if: guard genuinely suppresses reporting, rather than reporting a skip: on build 21213 the E2E Tests group was skipped and its commit status is missing entirely from the head SHA's statuses, while the four groups that ran all reported. The comment in pipeline.yml is right, and the guard has to stay in the script.

Locally, the four branches of the new guard, with should-skip-job.sh stubbed so the case is isolated:

BUILDKITE_PULL_REQUEST_DRAFT Result
true draft skip, exit 0, should-skip-job.sh never reached
unset falls through to should-skip-job.sh
false falls through
TRUE falls through (Buildkite emits lowercase)

This PR is opened as a draft on purpose — CLI E2E should skip on it with the annotation Skipping CLI E2E - draft PR, distinct from the doc-only message. Note the diff is .buildkite/**-only, which should-skip-job.sh already treats as non-code, so marking it ready will swap one skip message for the other rather than running the suite in full. That still demonstrates the load-bearing half: the draft guard stops firing once the PR is ready.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors? — N.A. this is a CI only change

@mokagio mokagio self-assigned this Aug 27, 2026
Comment thread .buildkite/pipeline.yml
Comment thread .buildkite/commands/run-cli-e2e-tests.sh
Comment thread .buildkite/commands/run-cli-e2e-tests.sh
Comment thread .buildkite/commands/run-cli-e2e-tests.sh
if [[ "${BUILDKITE_PULL_REQUEST_DRAFT:-false}" == "true" ]]; then
message="Draft PR detected. Skipping CLI E2E tests. They will run in full once PR is ready for review."
if command -v buildkite-agent &> /dev/null; then
echo "$message" | buildkite-agent annotate --style "info" --context "skip-cli-e2e-draft"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The LLM suggested to || true here, but I didn't like that. I'd rather know it ASAP if buildkite-agent annotate failed for some reason.

`E2E Tests` already skips drafts through an `if:` guard on the group.
`CLI E2E Tests` cannot use one — a required status check that never
reports leaves the PR waiting on it — so it runs on 99% of builds, for
859 agent-hours a month across mac, windows and linux.

The repo already solved this the other way: `run-cli-e2e-tests.sh`
exits 0 early for doc-only PRs and the check still reports green in
seconds. This extends that early exit to drafts, reclaiming roughly a
third of those hours and up to 20 minutes of wait on every draft PR.

`BUILDKITE_PULL_REQUEST_DRAFT` is exported only when the PR is a draft,
so the `:-false` default is load bearing. Verified against the job
environments of studio builds 21213 (draft, set to `true`) and 21397
(not a draft, absent).

The trade: a regression in a draft surfaces when the PR is marked ready
rather than on the draft's own build. `E2E Tests` already makes exactly
that trade, and CLI E2E still runs in full on the ready PR and on trunk.

AINFRA-3003.

---

Generated with the help of Claude Code, https://code.claude.com

Co-Authored-By: Claude Code Opus 5 <noreply@anthropic.com>
@mokagio
mokagio force-pushed the ainfra-3003-skip-studio-cli-e2e-on-draft-prs-keeping-the-check-reporting branch from 27aa8fe to 4a3b8a8 Compare August 28, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant