Skip to content

Commit 2c5891e

Browse files
committed
fix: hardcode main/master to always build (per review by @Mpdreamz)
Many repos keep legacy AsciiDoc docs on their default branch via the do-not-delete_legacy-docs pattern in conf.yaml, so skip-build detection is too risky to trust there. Bypassing legacy_branches.pl for main/master also means the check no longer depends on the perl YAML module.
1 parent 8eb8990 commit 2c5891e

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

‎.buildkite/scripts/build_pr.sh‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,22 @@ buildkite-agent \
4141

4242

4343
if [[ "${GITHUB_PR_BASE_REPO}" != 'docs' ]]; then
44-
# Skip the build but report success when the PR targets a branch that no longer carries
45-
# legacy AsciiDoc docs (per conf.yaml). docs-build-pr is a required check, so we exit 0
46-
# to keep it green rather than failing or leaving it pending.
47-
# The helper exits non-zero on a parse error or unknown repo, which short-circuits the
48-
# condition below so we build as today — i.e. fail open, never block a real build.
49-
if legacy_branches=$(perl "$(dirname "$0")/legacy_branches.pl" "$GITHUB_PR_BASE_REPO") \
50-
&& [[ -n "${legacy_branches}" ]] \
51-
&& ! grep -qxF "${GITHUB_PR_TARGET_BRANCH}" <<< "${legacy_branches}"; then
52-
echo "Target branch '${GITHUB_PR_TARGET_BRANCH}' has no legacy AsciiDoc docs in conf.yaml for ${GITHUB_PR_BASE_REPO} — skipping build (reporting success)."
53-
exit 0
44+
# main/master are hardcoded to always build, skipping the conf.yaml check below entirely:
45+
# many repos keep legacy AsciiDoc docs on their default branch via the
46+
# do-not-delete_legacy-docs pattern in conf.yaml, so this is the one case too risky to get
47+
# wrong, and hardcoding it means it works even when the perl YAML dep is missing.
48+
if [[ "${GITHUB_PR_TARGET_BRANCH}" != "main" && "${GITHUB_PR_TARGET_BRANCH}" != "master" ]]; then
49+
# Skip the build but report success when the PR targets a branch that no longer carries
50+
# legacy AsciiDoc docs (per conf.yaml). docs-build-pr is a required check, so we exit 0
51+
# to keep it green rather than failing or leaving it pending.
52+
# The helper exits non-zero on a parse error or unknown repo, which short-circuits the
53+
# condition below so we build as today — i.e. fail open, never block a real build.
54+
if legacy_branches=$(perl "$(dirname "$0")/legacy_branches.pl" "$GITHUB_PR_BASE_REPO") \
55+
&& [[ -n "${legacy_branches}" ]] \
56+
&& ! grep -qxF "${GITHUB_PR_TARGET_BRANCH}" <<< "${legacy_branches}"; then
57+
echo "Target branch '${GITHUB_PR_TARGET_BRANCH}' has no legacy AsciiDoc docs in conf.yaml for ${GITHUB_PR_BASE_REPO} — skipping build (reporting success)."
58+
exit 0
59+
fi
5460
fi
5561

5662
# Buildkite PR bot for repositories other than the `elastic/docs` repo are configured to

0 commit comments

Comments
 (0)