-
Notifications
You must be signed in to change notification settings - Fork 402
[JENKINS-39590] Switch to GitHub.parseEventPayload for event parsing
#155
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
Conversation
oleg-nenashev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to wait till the merge of the upstream PR before reviewing
pom.xml
Outdated
| <properties> | ||
| <jenkins.version>1.580</jenkins.version> | ||
| <jenkins-test-harness.version>1.580</jenkins-test-harness.version> | ||
| <jenkins.version>1.615</jenkins.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would vouch for using LTS baseline like 1.625 since you go beyond the Java 6 compat threshold anyway
| parseAssociatedNames((AbstractProject<?, ?>) item, result); | ||
| } | ||
| } else { | ||
| throw new AbstractMethodError("you must override the new overload of parseAssociatedNames"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see another PR
|
@oleg-nenashev I created this PR (and tagged as WIP) so that the upstream PRs can be reviewed with an intended usage example... i.e. This PR |
d2299c3 to
0c5db21
Compare
GitHub.parseEventPayload for event parsingGitHub.parseEventPayload for event parsing
|
@reviewbybees |
|
@reviewbybees ping |
| * @param payload payload of gh-event. Never blank | ||
| */ | ||
| @Override | ||
| protected void onEvent(GHEvent event, String payload) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does onEvent report errors itself? Then catch not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github-plugin/src/main/java/org/jenkinsci/plugins/github/extension/GHEventsSubscriber.java
Lines 208 to 214 in 93d4069
| try { | |
| subscriber.onEvent(event, payload); | |
| } catch (Throwable t) { | |
| LOGGER.error("Subscriber {} failed to process {} hook, skipping...", | |
| subscriber.getClass().getName(), event, t); | |
| } | |
| return null; |
so try-catch useless wrapper, undo change and check that parser reports meaningful error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That Throwable catch should be the last ditch catch. Propagation to it is not a good pattern.
I'll see if I can decipher what you mean tomorrow on computer not phone. But in general you should catch and log as close and as specific as possible while you know what sense to make...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In just you can trust to any underlying extension as it may throw NPE, so catching throwables and reporting is standard save ass pattern. If exception throws meaningful information then additional exception steps doesn't add anything useful for debugging.
KostyaSha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try-catch useless
|
LGTM |
|
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
| String fullDisplayName = job.getFullDisplayName(); | ||
| LOGGER.debug("Considering to poke {}", fullDisplayName); | ||
| if (GitHubRepositoryNameContributor.parseAssociatedNames(job) | ||
| .contains(changedRepository)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid gratuitous reformatting of otherwise unmodified lines.
|
@reviewbybees done |
|
released as 1.25.1 |
See JENKINS-39590
Work In Progress until hub4j/github-api#306 is merged and https://github.com/jenkinsci/github-api-plugin/ gets a release (also needs to be on top of #153)
This change is