Skip to content
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1bb3d66
Problem: [JENKINS-61290] hard to see why a branch was not inspected
jimklimov Mar 2, 2020
402482b
BranchDiscoveryTrait.java : reduce isExcluded() logging to head.toStr…
jimklimov Mar 2, 2020
48848cf
BranchDiscoveryTrait.java: use the SCM API TaskListener to log into t…
jimklimov Mar 6, 2020
588f891
Add mock data to test discovery of branches with or without PRs opene…
jimklimov Mar 6, 2020
7a33c3f
BranchDiscoveryTrait.java: add a newline after logging the excluded b…
jimklimov Mar 9, 2020
6bf938d
Merge remote-tracking branch 'upstream/master' into log-ignored-branc…
jimklimov Jun 4, 2020
edad8dd
BranchDiscoveryTrait.java : port the bit-field description comment fr…
jimklimov Jun 9, 2020
eaea9e9
BranchDiscoveryTrait.java : prune unneded blank line
jimklimov Jun 9, 2020
9f09397
Merge branch 'master' into log-ignored-branches
jimklimov Jun 23, 2020
2b0163e
Merge branch 'master' into log-ignored-branches
jimklimov Jan 10, 2021
5f7c21b
GitHubNotificationRequest.java: fix @see tag syntax
jimklimov Jan 10, 2021
5e35af3
Merge branch 'master' into log-ignored-branches
jimklimov Feb 3, 2021
aa1bf7f
Merge branch 'task/formatting-base' into log-ignored-branches
bitwiseman Mar 4, 2021
5fb18a8
Apply autoformatting
bitwiseman Mar 4, 2021
e5f915b
Merge remote-tracking branch 'upstream/master' into log-ignored-branches
bitwiseman Mar 4, 2021
31e1f76
Merge branch 'master' into log-ignored-branches
jimklimov Mar 22, 2021
5749a22
Merge branch 'master' into log-ignored-branches
jimklimov May 5, 2021
810eaf3
Merge branch 'master' into log-ignored-branches
jimklimov Jun 24, 2021
0cb1f9b
Merge branch 'master' into log-ignored-branches
jimklimov Jul 21, 2021
3c34f67
Merge remote-tracking branch 'upstream/master' as of 2023-08-26 into …
jimklimov Aug 26, 2023
eecfdf2
BranchDiscoveryTrait: "mvn spotless:apply" formatting to the source code
jimklimov Aug 26, 2023
f36f658
Merge branch 'master' into log-ignored-branches
jimklimov Mar 6, 2024
c7a4f4c
Merge branch 'master' into log-ignored-branches
jimklimov Mar 22, 2025
f21d0ea
Merge branch 'master' into log-ignored-branches
jimklimov Aug 4, 2025
4ec3fb3
Merge remote-tracking branch 'upstream/master' into log-ignored-branches
jimklimov Sep 2, 2025
d816c1a
Drop still-unused test JSON files [JENKINS-61290, PR #284]
jimklimov Sep 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,16 @@
/** All branches. */
public static final int ALL_BRANCHES = 3;

/** The strategy encoded as a bit-field. */
/**
* The strategy encoded as a bit-field.
*
* <dl>
* <dt>Bit 0
* <dd>Build branches that are not filed as a PR
* <dt>Bit 1
* <dd>Build branches that are filed as a PR
* </dl>
*/
private final int strategyId;

/**
Expand Down Expand Up @@ -221,28 +230,46 @@
if (headRepo != null // head repo can be null if the PR is from a repo that has been deleted
&& p.getBase().getRepository().getFullName().equalsIgnoreCase(headRepo.getFullName())
&& p.getHead().getRef().equals(head.getName())) {
// Log that we ignore the branch and why.
// 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;
}
}
}
return false;
}
}

/** Filter that excludes branches that are not also filed as a pull request. */
public static class OnlyOriginPRBranchesSCMHeadFilter extends SCMHeadFilter {
/** {@inheritDoc} */
@Override
public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) {
if (head instanceof BranchSCMHead && request instanceof GitHubSCMSourceRequest) {
for (GHPullRequest p : ((GitHubSCMSourceRequest) request).getPullRequests()) {
GHRepository headRepo = p.getHead().getRepository();
if (headRepo != null // head repo can be null if the PR is from a repo that has been deleted
&& p.getBase().getRepository().getFullName().equalsIgnoreCase(headRepo.getFullName())
&& p.getHead().getRef().equals(head.getName())) {
return false;
}
}
// Log that we ignore the branch and why.
// 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 NOT also filed as a pull request%n",
head.toString());

Check warning on line 272 in src/main/java/org/jenkinsci/plugins/github_branch_source/BranchDiscoveryTrait.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 236-272 are not covered by tests
return true;
}
return false;
Expand Down
Loading