Skip to content

Commit

Permalink
[CI] Pull in the latest mutes from base branch for PRs at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
brianseeders committed Nov 26, 2024
1 parent f05c9b0 commit b59f6b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public abstract class MutedTestsBuildService implements BuildService<MutedTestsB
public MutedTestsBuildService() {
File infoPath = getParameters().getInfoPath().get().getAsFile();
File mutedTestsFile = new File(infoPath, "muted-tests.yml");
excludePatterns.addAll(buildExcludePatterns(mutedTestsFile));
addExcludes(buildExcludePatterns(mutedTestsFile));
for (RegularFile regularFile : getParameters().getAdditionalFiles().get()) {
excludePatterns.addAll(buildExcludePatterns(regularFile.getAsFile()));
addExcludes(buildExcludePatterns(regularFile.getAsFile()));
}
}

Expand Down Expand Up @@ -94,6 +94,16 @@ private List<String> buildExcludePatterns(File file) {
return excludes;
}

private void addExcludes(List<String> 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();

Expand Down

0 comments on commit b59f6b2

Please sign in to comment.