Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-61290] hard to see why a branch was not inspected - log them #284

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 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
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 @@ public class BranchDiscoveryTrait extends SCMSourceTrait {
/** 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,6 +230,15 @@ public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead he
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;
}
}
Expand All @@ -243,6 +261,15 @@ public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead he
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());
return true;
}
return false;
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all of these new test resource files actually used? I do not see any new (Java) test code. Perhaps these are left over from some commits years earlier, or does some existing test actually fail without them?

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"name": "hotfix/BUGID-123456",
"commit": {
"sha": "b2e9d15d8311409d1adaeb139eeac0a8b436f5d8",
"node_id": "MDY6Q29tbWl0NzY0OTczNDA6YjJlOWQxNWQ4MzExNDA5ZDFhZGFlYjEzOWVlYWMwYThiNDM2ZjVkOA==",
"commit": {
"author": {
"name": "Some Contributor",
"email": "contributor@somemail.org",
"date": "2018-02-26T13:27:01Z"
},
"committer": {
"name": "GitHub",
"email": "noreply@github.com",
"date": "2018-02-26T13:27:01Z"
},
"message": "Quickly work around some problems",
"tree": {
"sha": "747f9b7dc5aa53ae1741caab8f8cb20a577c1c64",
"url": "https://api.github.com/repos/cloudbeers/yolo/git/trees/747f9b7dc5aa53ae1741caab8f8cb20a577c1c64"
},
"url": "https://api.github.com/repos/cloudbeers/yolo/git/commits/b2e9d15d8311409d1adaeb139eeac0a8b436f5d8",
"comment_count": 0,
"verification": {
"verified": true,
"reason": "valid",
"signature": "-----BEGIN PGP SIGNATURE-----\n\nPGP==HASH==\n-----END PGP SIGNATURE-----\n",
"payload": "tree 747f9b7dc5aa53ae1741caab8f8cb20a577c1c64\nparent 097b9948c911c706638ffb9f8af8056c9a9872da\nparent 4f76402ef5bfed3f56b22c6705b5052ac3f92e87\nauthor Some Contributor <contributor@somemail.org> 1519651621 +0100\ncommitter GitHub <noreply@github.com> 1519651621 +0100\n\nQuickly work around some problems"
}
},
"url": "https://api.github.com/repos/cloudbeers/yolo/commits/b2e9d15d8311409d1adaeb139eeac0a8b436f5d8",
"html_url": "https://github.com/cloudbeers/yolo/commit/b2e9d15d8311409d1adaeb139eeac0a8b436f5d8",
"comments_url": "https://api.github.com/repos/cloudbeers/yolo/commits/b2e9d15d8311409d1adaeb139eeac0a8b436f5d8/comments",
"author": {
"login": "somecontrib",
"id": 209336,
"node_id": "MDQ6VXNlcjE5Mzg3NDQx",
"avatar_url": "https://avatars1.githubusercontent.com/u/209336?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/somecontrib",
"html_url": "https://github.com/somecontrib",
"followers_url": "https://api.github.com/users/somecontrib/followers",
"following_url": "https://api.github.com/users/somecontrib/following{/other_user}",
"gists_url": "https://api.github.com/users/somecontrib/gists{/gist_id}",
"starred_url": "https://api.github.com/users/somecontrib/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/somecontrib/subscriptions",
"organizations_url": "https://api.github.com/users/somecontrib/orgs",
"repos_url": "https://api.github.com/users/somecontrib/repos",
"events_url": "https://api.github.com/users/somecontrib/events{/privacy}",
"received_events_url": "https://api.github.com/users/somecontrib/received_events",
"type": "User",
"site_admin": false
},
"committer": {
"login": "web-flow",
"id": 19864447,
"node_id": "MDQ6VXNlcjE5ODY0NDQ3",
"avatar_url": "https://avatars3.githubusercontent.com/u/19864447?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/web-flow",
"html_url": "https://github.com/web-flow",
"followers_url": "https://api.github.com/users/web-flow/followers",
"following_url": "https://api.github.com/users/web-flow/following{/other_user}",
"gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}",
"starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/web-flow/subscriptions",
"organizations_url": "https://api.github.com/users/web-flow/orgs",
"repos_url": "https://api.github.com/users/web-flow/repos",
"events_url": "https://api.github.com/users/web-flow/events{/privacy}",
"received_events_url": "https://api.github.com/users/web-flow/received_events",
"type": "User",
"site_admin": false
},
"parents": [
{
"sha": "097b9948c911c706638ffb9f8af8056c9a9872da",
"url": "https://api.github.com/repos/cloudbeers/yolo/commits/097b9948c911c706638ffb9f8af8056c9a9872da",
"html_url": "https://github.com/cloudbeers/yolo/commit/097b9948c911c706638ffb9f8af8056c9a9872da"
},
{
"sha": "4f76402ef5bfed3f56b22c6705b5052ac3f92e87",
"url": "https://api.github.com/repos/cloudbeers/yolo/commits/4f76402ef5bfed3f56b22c6705b5052ac3f92e87",
"html_url": "https://github.com/cloudbeers/yolo/commit/4f76402ef5bfed3f56b22c6705b5052ac3f92e87"
}
]
},
"_links": {
"self": "https://api.github.com/repos/cloudbeers/yolo/branches/hotfix/BUGID-123456",
"html": "https://github.com/cloudbeers/yolo/tree/hotfix/BUGID-123456"
},
"protected": true,
"protection": {
"enabled": true,
"required_status_checks": {
"enforcement_level": "everyone",
"contexts": [
"continuous-integration/jenkins/pr-head",
"continuous-integration/jenkins/pr-merge",
"continuous-integration/travis-ci"
]
}
},
"protection_url": "https://api.github.com/repos/cloudbeers/yolo/branches/hotfix/BUGID-123456/protection"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"name": "release/version-132",
"commit": {
"sha": "a5223ef8db4f717400489f42007ef73c6ce6dab7",
"node_id": "MDY6Q29tbWl0NzY0OTczNDA6YTUyMjNlZjhkYjRmNzE3NDAwNDg5ZjQyMDA3ZWY3M2M2Y2U2ZGFiNw==",
"commit": {
"author": {
"name": "Release Manager",
"email": "stephenc@somemail.com",
"date": "2018-09-19T13:14:30Z"
},
"committer": {
"name": "GitHub",
"email": "noreply@github.com",
"date": "2018-09-19T13:14:30Z"
},
"message": "Merge pull request #145 from stephenc/branchRelease-backports",
"tree": {
"sha": "5f8e3d0f46ba4b071f543a921e34879b017ad479",
"url": "https://api.github.com/repos/cloudbeers/yolo/git/trees/5f8e3d0f46ba4b071f543a921e34879b017ad479"
},
"url": "https://api.github.com/repos/cloudbeers/yolo/git/commits/a5223ef8db4f717400489f42007ef73c6ce6dab7",
"comment_count": 0,
"verification": {
"verified": true,
"reason": "valid",
"signature": "-----BEGIN PGP SIGNATURE-----\n\nPGP=HASH==\n-----END PGP SIGNATURE-----\n",
"payload": "tree 5f8e3d0f46ba4b071f543a921e34879b017ad479\nparent 2734e2ba489ce3b9fdba21e0ea1a7e2576ee9aeb\nparent 3d1abda5673d995df0278b6216b179156c30ff54\nauthor Release Manager <stephenc@somemail.com> 1537362870 +0200\ncommitter GitHub <noreply@github.com> 1537362870 +0200\n\nMerge pull request #145 from stephenc/branchRelease-backports"
}
},
"url": "https://api.github.com/repos/cloudbeers/yolo/commits/a5223ef8db4f717400489f42007ef73c6ce6dab7",
"html_url": "https://github.com/cloudbeers/yolo/commit/a5223ef8db4f717400489f42007ef73c6ce6dab7",
"comments_url": "https://api.github.com/repos/cloudbeers/yolo/commits/a5223ef8db4f717400489f42007ef73c6ce6dab7/comments",
"author": {
"login": "stephenc",
"id": 209336,
"node_id": "MDQ6VXNlcjkyMTE5Nw==",
"avatar_url": "https://avatars1.githubusercontent.com/u/209336?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/stephenc",
"html_url": "https://github.com/stephenc",
"followers_url": "https://api.github.com/users/stephenc/followers",
"following_url": "https://api.github.com/users/stephenc/following{/other_user}",
"gists_url": "https://api.github.com/users/stephenc/gists{/gist_id}",
"starred_url": "https://api.github.com/users/stephenc/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/stephenc/subscriptions",
"organizations_url": "https://api.github.com/users/stephenc/orgs",
"repos_url": "https://api.github.com/users/stephenc/repos",
"events_url": "https://api.github.com/users/stephenc/events{/privacy}",
"received_events_url": "https://api.github.com/users/stephenc/received_events",
"type": "User",
"site_admin": false
},
"committer": {
"login": "web-flow",
"id": 19864447,
"node_id": "MDQ6VXNlcjE5ODY0NDQ3",
"avatar_url": "https://avatars3.githubusercontent.com/u/19864447?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/web-flow",
"html_url": "https://github.com/web-flow",
"followers_url": "https://api.github.com/users/web-flow/followers",
"following_url": "https://api.github.com/users/web-flow/following{/other_user}",
"gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}",
"starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/web-flow/subscriptions",
"organizations_url": "https://api.github.com/users/web-flow/orgs",
"repos_url": "https://api.github.com/users/web-flow/repos",
"events_url": "https://api.github.com/users/web-flow/events{/privacy}",
"received_events_url": "https://api.github.com/users/web-flow/received_events",
"type": "User",
"site_admin": false
},
"parents": [
{
"sha": "2734e2ba489ce3b9fdba21e0ea1a7e2576ee9aeb",
"url": "https://api.github.com/repos/cloudbeers/yolo/commits/2734e2ba489ce3b9fdba21e0ea1a7e2576ee9aeb",
"html_url": "https://github.com/cloudbeers/yolo/commit/2734e2ba489ce3b9fdba21e0ea1a7e2576ee9aeb"
},
{
"sha": "3d1abda5673d995df0278b6216b179156c30ff54",
"url": "https://api.github.com/repos/cloudbeers/yolo/commits/3d1abda5673d995df0278b6216b179156c30ff54",
"html_url": "https://github.com/cloudbeers/yolo/commit/3d1abda5673d995df0278b6216b179156c30ff54"
}
]
},
"_links": {
"self": "https://api.github.com/repos/cloudbeers/yolo/branches/release/version-132",
"html": "https://github.com/cloudbeers/yolo/tree/release/version-132"
},
"protected": true,
"protection": {
"enabled": true,
"required_status_checks": {
"enforcement_level": "everyone",
"contexts": [
"continuous-integration/jenkins/pr-head",
"continuous-integration/jenkins/pr-merge",
"continuous-integration/travis-ci"
]
}
},
"protection_url": "https://api.github.com/repos/cloudbeers/yolo/branches/release/version-132/protection"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"name": "branchWithPR",
"commit": {
"sha": "8b62d23190bf5210b5688ef62534897bb730aeb7",
"node_id": "MDY6Q29tbWl0NzY0OTczNDA6OGI2MmQyMzE5MGJmNTIxMGI1Njg4ZWY2MjUzNDg5N2JiNzMwYWViNw==",
"commit": {
"author": {
"name": "stephenc",
"email": "stephenc@somemail.com",
"date": "2020-03-06T13:15:29Z"
},
"committer": {
"name": "stephenc",
"email": "stephenc@somemail.com",
"date": "2020-03-06T14:34:52Z"
},
"message": "Minor code cleanup\n\nSigned-off-by: stephenc <stephenc@somemail.com>",
"tree": {
"sha": "806bfa680bcc0f384935ac3a56f51c8b7334f18e",
"url": "https://api.github.com/repos/cloudbeers/yolo/git/trees/806bfa680bcc0f384935ac3a56f51c8b7334f18e"
},
"url": "https://api.github.com/repos/cloudbeers/yolo/git/commits/8b62d23190bf5210b5688ef62534897bb730aeb7",
"comment_count": 0,
"verification": {
"verified": true,
"reason": "valid",
"signature": "-----BEGIN PGP SIGNATURE-----\n\nPGP==HASH==\n-----END PGP SIGNATURE-----",
"payload": "tree 806bfa680bcc0f384935ac3a56f51c8b7334f18e\nparent be5d76394128d512458d736add63f8a67411cba0\nauthor stephenc <stephenc@somemail.com> 1583500529 +0100\ncommitter stephenc <stephenc@somemail.com> 1583505292 +0100\n\nMinor code cleanup\n\nSigned-off-by: stephenc <stephenc@somemail.com>\n"
}
},
"url": "https://api.github.com/repos/cloudbeers/yolo/commits/8b62d23190bf5210b5688ef62534897bb730aeb7",
"html_url": "https://github.com/cloudbeers/yolo/commit/8b62d23190bf5210b5688ef62534897bb730aeb7",
"comments_url": "https://api.github.com/repos/cloudbeers/yolo/commits/8b62d23190bf5210b5688ef62534897bb730aeb7/comments",
"author": {
"login": "stephenc",
"id": 209336,
"node_id": "MDQ6VXNlcjk4NzI5Njk=",
"avatar_url": "https://avatars1.githubusercontent.com/u/209336?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/stephenc",
"html_url": "https://github.com/stephenc",
"followers_url": "https://api.github.com/users/stephenc/followers",
"following_url": "https://api.github.com/users/stephenc/following{/other_user}",
"gists_url": "https://api.github.com/users/stephenc/gists{/gist_id}",
"starred_url": "https://api.github.com/users/stephenc/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/stephenc/subscriptions",
"organizations_url": "https://api.github.com/users/stephenc/orgs",
"repos_url": "https://api.github.com/users/stephenc/repos",
"events_url": "https://api.github.com/users/stephenc/events{/privacy}",
"received_events_url": "https://api.github.com/users/stephenc/received_events",
"type": "User",
"site_admin": false
},
"committer": {
"login": "stephenc",
"id": 209336,
"node_id": "MDQ6VXNlcjk4NzI5Njk=",
"avatar_url": "https://avatars1.githubusercontent.com/u/209336?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/stephenc",
"html_url": "https://github.com/stephenc",
"followers_url": "https://api.github.com/users/stephenc/followers",
"following_url": "https://api.github.com/users/stephenc/following{/other_user}",
"gists_url": "https://api.github.com/users/stephenc/gists{/gist_id}",
"starred_url": "https://api.github.com/users/stephenc/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/stephenc/subscriptions",
"organizations_url": "https://api.github.com/users/stephenc/orgs",
"repos_url": "https://api.github.com/users/stephenc/repos",
"events_url": "https://api.github.com/users/stephenc/events{/privacy}",
"received_events_url": "https://api.github.com/users/stephenc/received_events",
"type": "User",
"site_admin": false
},
"parents": [
{
"sha": "be5d76394128d512458d736add63f8a67411cba0",
"url": "https://api.github.com/repos/cloudbeers/yolo/commits/be5d76394128d512458d736add63f8a67411cba0",
"html_url": "https://github.com/cloudbeers/yolo/commit/be5d76394128d512458d736add63f8a67411cba0"
}
]
},
"_links": {
"self": "https://api.github.com/repos/cloudbeers/yolo/branches/branchWithPR",
"html": "https://github.com/cloudbeers/yolo/tree/branchWithPR"
},
"protected": false,
"protection": {
"enabled": false,
"required_status_checks": {
"enforcement_level": "off",
"contexts": [

]
}
},
"protection_url": "https://api.github.com/repos/cloudbeers/yolo/branches/branchWithPR/protection"
}
Loading