From cfcfdf10a5deaac691fc1cf7096f0c7786b2c24a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 9 Jun 2020 13:40:43 +0200 Subject: [PATCH] [JENKINS-61290] hard to see why a branch was not inspected - log them BranchDiscoveryTrait.java : report into scan log if a branch is ignored (because it is or is-not a source of PR, based on user choice of settings) similarly as proposed and refined for github-branch-source-plugin in https://github.com/jenkinsci/github-branch-source-plugin/pull/284 --- .../plugins/bitbucket/BranchDiscoveryTrait.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BranchDiscoveryTrait.java b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BranchDiscoveryTrait.java index f46e44252..565e35b11 100644 --- a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BranchDiscoveryTrait.java +++ b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BranchDiscoveryTrait.java @@ -245,6 +245,12 @@ public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead he BitbucketRepository source = pullRequest.getSource().getRepository(); if (fullName.equalsIgnoreCase(source.getFullName()) && pullRequest.getSource().getBranch().getName().equals(head.getName())) { + // End the format with newline to avoid logging this + // result blocked together with a later indexed branch + request.listener().getLogger().format( + "Ignoring %s because current strategy excludes branches " + + "that ARE also filed as a pull request%n" + , head.toString()); return true; } } @@ -272,6 +278,10 @@ public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead he return false; } } + request.listener().getLogger().format( + "Ignoring %s because current strategy excludes branches " + + "that ARE NOT also filed as a pull request%n" + , head.toString()); return true; } return false;