Skip to content

👷 Draft-aware BrowserStack jobs#4522

Draft
thomas-lebeau wants to merge 2 commits intomainfrom
thomas.lebeau/draft-aware-bs-jobs
Draft

👷 Draft-aware BrowserStack jobs#4522
thomas-lebeau wants to merge 2 commits intomainfrom
thomas.lebeau/draft-aware-bs-jobs

Conversation

@thomas-lebeau
Copy link
Copy Markdown
Collaborator

@thomas-lebeau thomas-lebeau commented Apr 23, 2026

Motivation

BrowserStack (BS) jobs currently run on every pipeline, including draft PRs, consuming parallelism budget on work that is not yet ready for review. This change makes BS jobs opt-in (manual) on drafts and automatic once the PR is ready for review.

Changes

  • Make unit-bs and e2e-bs manual (when: manual, allow_failure: true). On drafts / branches without a PR, they stay as a "play" button and don't block the pipeline.
  • Add unit-bs-auto-play and e2e-bs-auto-play jobs (needs: ['unit'] / needs: ['e2e']). Each runs scripts/test/play-bs-job.ts <job-name>, which:
    • Calls fetchPR to check the branch's PR state.
    • If the PR is open and not a draft, obtains a short-lived GitLab project access token via bti-ci-api (SDM JWT via authanywhere), then POST /jobs/:id/play to trigger the matching manual BS job.
    • Otherwise no-ops — the BS job stays as a play button.
  • Expose draft: boolean on the GitHubPR interface returned by fetchPR.

Test instructions

On CI:

  1. Open this PR as a draft and push a commit.
  2. In the pipeline UI, confirm unit-bs and e2e-bs show as manual (play button). Confirm unit-bs-auto-play / e2e-bs-auto-play succeed and log PR #<n> is a draft; <job> remains manual..
  3. Mark the PR as ready for review and push another commit or re-run the two *-bs-auto-play jobs.
  4. Confirm unit-bs-auto-play / e2e-bs-auto-play play the BS jobs automatically (log: played <job> (job id …)), and unit-bs / e2e-bs run to completion.
  5. Optional: flip back to draft + push. BS jobs should return to manual on the next pipeline.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented Apr 23, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 179.27 KiB 179.27 KiB 0 B 0.00%
Rum Profiler 6.16 KiB 6.16 KiB 0 B 0.00%
Rum Recorder 27.03 KiB 27.03 KiB 0 B 0.00%
Logs 56.65 KiB 56.65 KiB 0 B 0.00%
Rum Slim 135.11 KiB 135.11 KiB 0 B 0.00%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance

Pending...

🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 30.86 KiB 31.81 KiB +973 B
RUM - add action 104.43 KiB 94.37 KiB -10.06 KiB
RUM - add timing 33.36 KiB 31.77 KiB -1.58 KiB
RUM - add error 97.64 KiB 97.61 KiB -32 B
RUM - start/stop session replay recording 32.49 KiB 31.53 KiB -984 B
RUM - start view 488.94 KiB 483.25 KiB -5.69 KiB
Logs - log message 104.78 KiB 93.40 KiB -11.38 KiB

🔗 RealWorld

@datadog-prod-us1-6
Copy link
Copy Markdown

datadog-prod-us1-6 Bot commented Apr 23, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 77.01% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 229e86a | Docs | Datadog PR Page | Give us feedback!

@thomas-lebeau thomas-lebeau force-pushed the thomas.lebeau/draft-aware-bs-jobs branch 2 times, most recently from 2a98420 to b89c0a4 Compare April 23, 2026 13:48
@thomas-lebeau thomas-lebeau changed the title 👷 Draft-aware BrowserStack jobs 👷 Draft-aware BrowserStack jobs Apr 23, 2026
@thomas-lebeau thomas-lebeau marked this pull request as ready for review April 23, 2026 14:59
@thomas-lebeau thomas-lebeau requested a review from a team as a code owner April 23, 2026 14:59
@thomas-lebeau thomas-lebeau marked this pull request as draft April 24, 2026 06:16
unit-bs and e2e-bs are declared as when: manual in the parent pipeline.
A new bs-auto-play job queries the GitHub API for the branch's PR
state and, when the PR is open and not a draft, plays both BS jobs
via the GitLab jobs API (authenticated with CI_JOB_TOKEN). Drafts,
no-PR, and multi-PR cases leave the jobs as manual so they can be
started with a click.
@thomas-lebeau thomas-lebeau force-pushed the thomas.lebeau/draft-aware-bs-jobs branch from b89c0a4 to 10d6ddf Compare April 24, 2026 12:08
@thomas-lebeau thomas-lebeau marked this pull request as ready for review April 24, 2026 12:14
Copy link
Copy Markdown

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

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: 10d6ddf0fa

ℹ️ 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-ci.yml
Comment thread scripts/test/play-bs-job.ts Outdated
@thomas-lebeau thomas-lebeau marked this pull request as draft April 24, 2026 12:19
When a branch has multiple open PRs, `fetchPR` throws an ambiguous-match
error. Catch it and leave the BrowserStack job manual rather than fail
the pipeline.
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