feature/build only branches with legacy asciidoc#3233
Conversation
|
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. |
22eeebd to
705d25e
Compare
The buildkite/docs-build-pr status check is required in some repos. This way it will stay green
|
We have other docs sets that are not on stack versioning that wouldn't be caught in this fix. This would help a lot with certain repos but I wonder if it needs to be refactored to cover stuff like ECE 4+ and ECK 3+ |
|
I'm trying to think through Shaina's comment. We could potentially pair Jan's change here with the repo-specific instructions that start on L68. We could write a script to parse conf.yaml and spit out a mapping of each repo and the versions of documentation that are contained within that repo. We could then check against those versions. For example: # repositories with a docs dir and changelog
"apm-aws-lambda" | "apm-agent-android" | "apm-agent-nodejs" | "apm-agent-python" | "apm-agent-ruby" | "apm-agent-rum-js" | "apm-agent-go" | "apm-agent-java" | "apm-agent-dotnet" | "apm-agent-php" | "apm-agent-ios")
+ if ! [[ $GITHUB_PR_TARGET_BRANCH =~ {NEWREGEXHERE} ]]; then
+ echo "Target branch '$GITHUB_PR_TARGET_BRANCH' is not a valid version branch (must be in format
+ X.Y where X <= 8)"
+ exit 0
+ fi
git fetch origin "$GITHUB_PR_TARGET_BRANCH"
docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- "./docs/**.asciidoc" CHANGELOG.asciidoc)
;;(this is just to illustrate) |
* Buildkite: Skip PR builds for non-legacy branches 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> * fix: build only when conf.yaml has a legacy branch match (per review by @Mpdreamz) main/master are hardcoded to always skip since they no longer carry legacy AsciiDoc docs. For every other branch, flip from fail-open (build unless proven migrated) to positive-match (build only if conf.yaml lists the branch as legacy) — an empty or missing conf.yaml entry now means skip. Genuine parse failures (e.g. missing YAML module) still fail open and build, since we can't tell in that case. legacy_branches.pl resolves a GitHub repo name to its conf.yaml key by trying a direct key match before falling back to URL-basename translation, since both forms occur (e.g. "esf" is used directly, while "elastic-serverless-forwarder" only matches via its source URL). The basename-only version silently returned no legacy branches for "esf", "kibana-cn", and "swiftype", which would have always skipped their builds. Added legacy_branches.t as a regression check. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Changes
Only build 8.x target branches.
Context
According to https://github.com/elastic/buildkite-pr-bot?tab=readme-ov-file#configuration-1 you can actually set the
target_branchinpull-requests.org-wide.json.However, the
buildkite/docs-build-prstatus check is usually a required check.In this PR we exit early if the target branch doesn't match the pattern, so that the status check will still be green.