From b59f6b23bc3c5d85f6476b0a21655957aafb3b5a Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Tue, 26 Nov 2024 13:57:37 -0500 Subject: [PATCH] [CI] Pull in the latest mutes from base branch for PRs at runtime --- .buildkite/hooks/pre-command | 4 ++++ .../internal/test/MutedTestsBuildService.java | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 0ece129a3c238..b4907eac95a8a 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -117,3 +117,7 @@ if [[ -f /etc/os-release ]] && grep -q '"Amazon Linux 2"' /etc/os-release; then echo "$(hostname -i | cut -d' ' -f 2) $(hostname -f)." | sudo tee /etc/dnsmasq.hosts sudo systemctl restart dnsmasq.service fi + +if [[ "${BUILDKITE_PULL_REQUEST:-}" ]]; then + source .buildkite/scripts/get-latest-test-mutes.sh +fi diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/MutedTestsBuildService.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/MutedTestsBuildService.java index 1dfa3bbb29aa2..c12da7bad6ec5 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/MutedTestsBuildService.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/MutedTestsBuildService.java @@ -37,9 +37,9 @@ public abstract class MutedTestsBuildService implements BuildService buildExcludePatterns(File file) { return excludes; } + private void addExcludes(List excludes) { + // Don't add the same exclude multiple times + for (String exclude : excludes) { + if (excludePatterns.stream().noneMatch(e -> e.equals(exclude))) { + excludePatterns.add(exclude); + } + } + + } + public interface Params extends BuildServiceParameters { RegularFileProperty getInfoPath();