Repository navigation
[raycicmd] add skip-form label rules; reject before marking deps - #511
Conversation
Label rules gain skip_tags_unless_present and skip_tags_when_present. They add tags to the filter's skip set by the label's state, so a skipped step is rejected and steps that depend on it are rejected too, the same as configured skip_tags. convertGroups now runs rejectDeps before markDeps and drops rejected hits first. Marking first pulled a rejected step's own dependencies, such as its images, into the pipeline through a selected step that depends on it, even though both steps were then rejected. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces new label rules skip_tags_unless_present and skip_tags_when_present to allow skipping pipeline steps based on the presence or absence of specific labels. It also refactors the step conversion logic in converter.go to reject dependencies first, ensuring that a step depending on a rejected step is also rejected without pulling in its dependencies. Unit tests have been added to verify these new features. There are no review comments, so I have no feedback to provide.
…l-rules Signed-off-by: Douglas Strodtman <[email protected]>
|
Suggestion for the follow-up that removes Ray's Why: the if: build.pull_request.labels includes "continuous-build" || pipeline.id == "0189e759-8c96-4302-b6b5-b4274406bf89" || pipeline.id == "018f4f1e-1b73-4906-9802-92422e3badaa"They run when the label is present or on postmerge. With this PR as written, One thing that changes: Happy for this to be a small change here or a follow-up before Ray adopts the rules. |
A non-PR build has no labels, so a skip_tags_unless_present rule skipped its steps on postmerge. That breaks a gate such as Ray's continuous-build, which runs when the label is present or on postmerge. Label rules now apply only when BUILDKITE_PULL_REQUEST names a PR, so non-PR builds select steps as they did before label rules existed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
|
Done in 7f4fb94: label rules now apply only when |
elliot-barn
left a comment
There was a problem hiding this comment.
Thanks, 7f4fb94 looks good. Yes to both: cascading matches skip_tags, which is what I'd expect, and the reorder is a real fix with no change to Ray's current output, so fine to keep it here.
…label rules (#67341) > [!IMPORTANT] > Draft until rayci ships label rules ([rayci#510](ray-project/rayci#510), [rayci#511](ray-project/rayci#511)) and this PR bumps `.rayciversion` to that release. Don't merge it before then: today's rayci ignores `*.labels.yaml`, so removing the per-step gates would stop the `docstring-only` label from skipping Ray Data's suites. ## Why are these changes needed? The `docstring-only` and `docs-example-test` labels gate steps with Buildkite `if:` conditions, which Buildkite evaluates after rayci has selected the steps and marked their dependencies. That causes two problems: - **Images build for steps that don't run.** An unlabeled prose PR builds the 5 images only the opt-in step needs. An unlabeled Python PR builds `docstringbuild` for `doc: docstring examples`. - **`docstring-only` covers only Ray Data.** Each skipped step needs its own negated `if:`. Extending the label means a gate on nearly every premerge test step, and a new step that forgets one silently runs under the label. rayci#510 and #511 let PR labels adjust step selection before dependency marking, through rules in `.buildkite/*.labels.yaml`. This PR adopts them. ## What changes - **Adds `.buildkite/docs.labels.yaml`** with the following rules: - `docstring-only` keeps only steps tagged `always`, `lint`, `doc_api`, or `docstring_examples`. That's the same set a labeled Data PR runs today (`doc/source/ray-contribute/ci.md`): the docstring examples step, the two API surface checks, lint, and the scope guard, which is tagged `always`. It now applies to every library, not just Ray Data. Without the label, it skips `doc: docstring examples`. - `docs-example-test` skips the opt-in step without the label. - **Tags the two steps** in `others.rayci.yml`: `docstring_examples` on `doc: docstring examples`, and `doc_example_optin` on `doc: docs example tests (opt-in)`. - **Removes the 10 negated `docstring-only` gates** from `data.rayci.yml`. - **Keeps the positive `if:` gates** on the examples step, the opt-in step, and the scope guard. They're redundant now, but they show a reader of the step why it's label-gated. ## Behavior change to review Under `docstring-only`, examples that need torch or TensorFlow are reported as skipped by the light examples image, and their library's `doctest()` target is skipped with the rest of the suites. Today that's true only for Ray Data. With this PR it's true for every library, so those examples get no premerge coverage on a labeled PR. `ml: data integration tests`, which #67237 gates with its own `if:`, is also covered by the keep-only rule, so that gate becomes redundant. ## Duplicate check No open PR adopts rayci label rules, which don't exist yet in a release. Related open PRs: #67237 adds a `docstring-only` gate to `ml: data integration tests`, and #67204 rewrites the `docstring-only` section of `ci.md`. The `ci.md` update for this change (the label covering every library) waits until #67204 lands, to avoid conflicting with it. ## Testing I generated the premerge pipeline locally with a Linux build of rayci #510 and #511 against this branch. Each row simulates a PR that changes one file: | Simulated PR | rayci v0.50.0 on master | This branch, unlabeled | This branch, labeled | |---|---|---|---| | Doc prose (`doc/source/data/aggregating-data.md`) | 11 steps | 5 steps: the opt-in step and the 5 images only it needs drop | 11 steps with `docs-example-test` | | Ray Data docstring (`python/ray/data/dataset.py`) | 51 steps | 49 steps: `doc: docstring examples` and `docstringbuild` drop | 19 steps with `docstring-only` | | Core docstring (`python/ray/actor.py`) | 165 steps | 163 steps: the same 2 drop | 19 steps with `docstring-only` | The 19 labeled steps are test-rules, the lint steps, the scope guard, both API surface checks, `doc: docstring examples`, and their images. Apart from the two dropped steps, unlabeled pipelines are identical to v0.50.0 on master. `pre-commit run` on the changed files passes. Once a rayci release exists, the `.rayciversion` bump goes here and premerge runs with and without each label. This PR was prepared with AI assistance (Claude Code). It stays in draft until a human review of every changed line and a premerge run on the release. --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Stacked on #510. Review that first; this PR's diff is against its branch.
Why
#510 adds keep-only label rules, which narrow selection without rejecting anything. Some steps instead need to be skipped by label: an opt-in step that should run only when a label is present, such as Ray's
doc: docs example tests (opt-in)gated ondocs-example-test. Today that gate is anif:that Buildkite evaluates after upload, so an unlabeled PR still builds the step's images.What changes
Two skip forms for label rules:
They add tags to the filter's skip set by the label's state, so they behave exactly like configured
skip_tags: a skipped step is rejected, and so is every step that depends on it. Matchingskip_tagswas deliberate, so a label-skipped step and a config-skipped step behave the same. Buildkite's docs say a step whoseif:is false becomesbroken, but they don't say what happens to steps that depend on it, so this may differ from today'sif:gates when a step depends on a gated one. No step in Ray does today.Label rules apply only to pull request builds. When
BUILDKITE_PULL_REQUESTisfalse, rayci doesn't apply them and logsnot a pull request build: label rules not applied, so non-PR builds select steps as they did before label rules existed. This keeps gates such as Ray'scontinuous-build, which run when the label is present or on postmerge, expressible as a rule. A label-only gate such asdocs-example-testkeeps itsif:to stay off postmerge.convertGroupsrejects before it marks dependencies. Writing the cascade test exposed a gap that already affects configuredskip_tags. When a selected step depends on a skipped step,markDepsran first and marked the skipped step's own dependencies through the selected one.rejectDepsthen rejected both steps but left those dependencies marked, so a skipped step's images still built. NowrejectDepsruns first, rejected hits are dropped, andmarkDepsruns from the hits that remain. Because a step that depends on a rejected step is itself rejected, the remaining hits can't reach a rejected step, so the only nodes this change unmarks are ones reachable solely through rejected steps.Testing
convertGroupsunder each form with the label present and absent. The tests cover the image only the skipped step needs being dropped, a shared image staying, and a dependent of the skipped step being rejected. Without the reorder, the dropped-image case fails.makePipelinetest covers askip_tags_unless_presentrule on PR builds with and without the label, and on non-PR builds, where neither skip nor keep-only rules apply. Without the PR-only check, the non-PR cases fail.go test ./...,go fmt, pre-commit, andrayci-lint go-filelengthandgo-coveragepass.raycicmdcoverage is 90.6%.ray-project/raymaster at8fdacd39fd4:docs-example-testrule as above, and the opt-in step taggeddoc_example_optin, an unlabeled doc prose PR emits 5 steps instead of 11. The opt-in step and the 5 image jobs only it needs drop. With the label, all 11 are emitted.Questions for review
skip_tags?skip_tagsbehavior in the case above. Would you rather land it as its own PR first?🤖 Generated with Claude Code