From c4c40e569769550e4b63483d9fe9012de1315543 Mon Sep 17 00:00:00 2001 From: kruskall <99559985+kruskall@users.noreply.github.com> Date: Thu, 12 Sep 2024 23:16:10 +0200 Subject: [PATCH 1/2] feat(all): only build docs if there's a doc change extend the check to all remaining repositories --- .buildkite/scripts/build_pr.sh | 102 ++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/.buildkite/scripts/build_pr.sh b/.buildkite/scripts/build_pr.sh index 70fa3c9cd8ce..a01addabb3f1 100755 --- a/.buildkite/scripts/build_pr.sh +++ b/.buildkite/scripts/build_pr.sh @@ -66,7 +66,7 @@ if [[ "${GITHUB_PR_BASE_REPO}" != 'docs' ]]; then ;; # repositories with a docs dir - "apm-k8s-attacher") + "apm-k8s-attacher" | "cloud" | "cloud-assets" | "cloud-on-k8s" | "ecctl" | "ecs" | "ecs-dotnet" | "ecs-logging" | "ecs-logging-go-logrus" | "ecs-logging-go-zap" | "ecs-logging-go-zerolog" | "ecs-logging-java" | "ecs-logging-nodejs" | "ecs-logging-php" | "ecs-logging-python" | "ecs-logging-ruby" | "elasticsearch-js" | "elasticsearch-js-legacy" | "elasticsearch-ruby" | "elasticsearch-php" | "elasticsearch-perl" | "elasticsearch-rs" | "kibana-cn" | "logstash" | "logstash-docs" | "security-docs" | "sense" | "swiftype") git fetch origin "$GITHUB_PR_TARGET_BRANCH" docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs) ;; @@ -77,6 +77,106 @@ if [[ "${GITHUB_PR_BASE_REPO}" != 'docs' ]]; then docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs ./changelogs CHANGELOG.asciidoc) ;; + "beats") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./auditbeat ./CHANGELOG.asciidoc ./docs ./filebeat ./heartbeat ./journalbeat ./libbeat/docs ./libbeat/outputs/*/docs/* ./libbeat/processors/*/docs/* ./metricbeat ./packetbeat ./topbeat/docs ./winlogbeat ./x-pack/auditbeat ./x-pack/dockerlogbeat/docs ./x-pack/filebeat/docs ./x-pack/filebeat/processors/*/docs/* ./x-pack/functionbeat ./x-pack/libbeat/docs ./x-pack/libbeat/processors/*/docs/* ./x-pack/metricbeat/module) + ;; + + "clients-team") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/examples/elastic-cloud) + ;; + + "curator") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/asciidoc) + ;; + + "eland" | "enterprise-search-php" | "enterprise-search-python" | "enterprise-search-ruby") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/guide) + ;; + + "elasticsearch") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./buildSrc ./build-tools-internal ./build-tools/src/main/resources ./client ./docs ./modules/reindex/src/internalClusterTest/java/org/elasticsearch/client/documentation ./modules/reindex/src/test/java/org/elasticsearch/client/documentation ./plugins/examples ./server/src/internalClusterTest/java/org/elasticsearch/client/documentation ./server/src/main/resources/org/elasticsearch/common ./server/src/test/java/org/elasticsearch/client/documentation ./x-pack/docs ./x-pack/plugin/esql/qa/testFixtures/src/main/resources ./x-pack/plugin/sql/qa ./x-pack/qa/sql) + ;; + + "elasticsearch-hadoop") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/src/reference/asciidoc) + ;; + + "elasticsearch-java") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs ./java-client/src/test/java/co/elastic/clients/documentation) + ;; + + "elasticsearch-net") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs ./tests/Tests/Documentation) + ;; + + "elasticsearch-py") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/guide ./docs/examples) + ;; + + "go-elasticsearch") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./.doc) + ;; + + "enterprise-search-pubs") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./enterprise-search-docs ./workplace-search-docs ./app-search-docs ./esre-docs ./client-docs/app-search-javascript ./client-docs/app-search-node ./client-docs/workplace-search-node) + ;; + + "enterprise-search-js") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./packages/enterprise-search/docs) + ;; + + "esf" | "ingest-docs" | "observability-docs" | "stack-docs" | "x-pack-logstash") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/en) + ;; + + "kibana") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs ":(glob)x-pack/**/*.asciidoc" ":(glob)src/**/*.asciidoc" ":(glob)examples/**/*.asciidoc") + ;; + + "packagespec") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./versions ./spec) + ;; + + "tech-content") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./welcome-to-elastic) + ;; + + "terraform-provider-ec") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs-elastic) + ;; + + "x-pack") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/public/graph ./docs/public/marvel ./docs/public/reporting ./docs/public/shield ./docs/public/watcher ./docs/en ./docs/kr ./docs/jp) + ;; + + "x-pack-elasticsearch") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/en ./docs/kr ./docs/jp ./qa/sql) + ;; + + "x-pack-kibana") + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/en ./docs/kr ./docs/jp) + ;; + # All other repos will always build *) docs_diff="always build" From ccc762d05bed7100331e4f396138c2127b8b7150 Mon Sep 17 00:00:00 2001 From: Brandon Morelli Date: Mon, 21 Oct 2024 09:22:57 -0700 Subject: [PATCH 2/2] Update build_pr.sh --- .buildkite/scripts/build_pr.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.buildkite/scripts/build_pr.sh b/.buildkite/scripts/build_pr.sh index a01addabb3f1..55340a499e7f 100755 --- a/.buildkite/scripts/build_pr.sh +++ b/.buildkite/scripts/build_pr.sh @@ -142,11 +142,6 @@ if [[ "${GITHUB_PR_BASE_REPO}" != 'docs' ]]; then docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs/en) ;; - "kibana") - git fetch origin "$GITHUB_PR_TARGET_BRANCH" - docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./docs ":(glob)x-pack/**/*.asciidoc" ":(glob)src/**/*.asciidoc" ":(glob)examples/**/*.asciidoc") - ;; - "packagespec") git fetch origin "$GITHUB_PR_TARGET_BRANCH" docs_diff=$(git diff --stat "origin/$GITHUB_PR_TARGET_BRANCH"...HEAD -- ./versions ./spec)