Buildkite: Skip PR builds for non-legacy branches#3343
Conversation
Make the docs-build-pr check exit 0 early (reporting success on the still-required check) when a PR targets a branch that no longer carries legacy AsciiDoc docs. A new Perl helper derives each repo's legacy branch set from conf.yaml so the guard stays correct as products migrate to docs-builder, without hardcoded version patterns. Supersedes #3233, which used a single regex that broke non-stack-versioned doc sets (e.g. ECE's ms-* branches, ECK 3.x). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
A documentation preview will be available soon. Request a new doc build by commenting
If your PR continues to fail for an unknown reason, the doc build pipeline may be broken. Elastic employees can check the pipeline status here. |
Mpdreamz
left a comment
There was a problem hiding this comment.
This is great and love the pl checking conf.yml
I think we can hardcore main and master as fallback even if the yaml dep is missing?
|
Fixed in 2c5891e — added a pre-check that hardcodes |
…dreamz) We no longer build legacy AsciiDoc docs against main/master, so skip them outright without depending on conf.yaml or the perl YAML module.
|
Correction to my earlier comment: main/master should always skip the build, not always build — we no longer build legacy AsciiDoc docs against those branches. Fixed in 7368322 (amended over the previous, incorrect commit): a pre-check now exits 0 for |
What
Make the required
buildkite/docs-build-prcheck exit 0 early (reporting success without building) when a PR targets a branch that no longer carries legacy AsciiDoc docs.Why
As docs migrate from this legacy AsciiDoc system to docs-builder, PRs targeting already-migrated branches (stack
main/9.x, ECK3.x, etc.) still trigger the required check and run a useless build. We want those to go green instantly. The check can't simply be removed because it's required.This supersedes #3233, whose single regex
^([0-8])\.[0-9]+$broke non-stack-versioned doc sets, as reviewers flagged:cloud) uses milestone branch names (ms-119,ms-105…) → matched nothing → would have wrongly skipped every ECE build.cloud-on-k8s) is legacy only on2.x/1.x/0.x;3.xlives in docs-builder but matched^[0-8]\.→ would have wrongly built.How
.buildkite/scripts/legacy_branches.plderives each repo's legacy branch set directly fromconf.yaml— reusing the build's ownYAML::LoadFileparser and the branch-resolution convention fromlib/ES/Book.pm/lib/ES/BranchTracker.pm(LHS branch keys,map_branches,exclude_branches). It maps the GitHub repo name to the conf repo key via the top-levelrepos:URL map (handles cases likeesf→elastic-serverless-forwarder).build_pr.shconsults the helper inside the product-repo path (before cloning) and exits 0 when the target branch isn't in the repo's legacy set. Fails open on any helper error or unknown repo, so a real build is never blocked.conf.yamlmeans the guard needs no edits as products migrate — no hardcoded version patterns.Test plan
Verified the helper locally (Perl
YAMLpresent):legacy_branches.pl elasticsearch→8.19 … 0.90, no9.xlegacy_branches.pl cloud→ms-*milestones (+master), nomainlegacy_branches.pl cloud-on-k8s→0.8 … 2.16, no3.xlegacy_branches.pl elastic-serverless-forwarder→ resolves viaesfkeylegacy_branches.pl clients-team→main(provesmap_branches)shellcheck .buildkite/scripts/build_pr.shclean for the new guardBehavioral:
elasticsearch+main→ skip 0;+8.18→ build.cloud+main→ skip 0;+ms-119→ build.cloud-on-k8s+3.0→ skip 0;+2.16→ build.Notes
The guard runs on the host agent (
docs-ubuntu-2204).libyaml-perlis installed in the buildDockerfile(inside the container) but the host image's PerlYAMLstatus is unconfirmed. The fail-open behavior means no regression if it's missing — the skip simply won't take effect untillibyaml-perlis added to the agent image (verify withperl -MYAML -e1).🤖 Generated with Claude Code