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-30626] Handle pings from organization webhooks #89

Closed

Conversation

jglick
Copy link
Member

@jglick jglick commented Sep 23, 2015

JENKINS-30626

Reference

@reviewbybees esp. @recena who discovered this bug.

@ghost
Copy link

ghost commented Sep 23, 2015

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.

@recena
Copy link
Contributor

recena commented Sep 23, 2015

Of course! 🐝 and 👍

@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@oleg-nenashev
Copy link
Member

🐝 , but seems to be significant enough to have a JIRA issue. Does the original code fail with NPE?

@amuniz
Copy link
Member

amuniz commented Sep 24, 2015

🐝

@jglick jglick changed the title Handle pings from organization webhooks [JENKINS-30626] Handle pings from organization webhooks Sep 24, 2015
@lanwen
Copy link
Member

lanwen commented Sep 24, 2015

Please add a test with such payload same as for the ping.

@@ -10,7 +10,7 @@
import java.util.Set;

import static com.google.common.collect.Sets.immutableEnumSet;
import static net.sf.json.JSONObject.fromObject;
import net.sf.json.JSONObject;
Copy link
Member

Choose a reason for hiding this comment

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

then it should be not in static block of imports

@lanwen
Copy link
Member

lanwen commented Sep 24, 2015

👍 thanks. I'll going to squash this and merge manually

@jglick jglick closed this in 03b1c87 Sep 24, 2015
@recena
Copy link
Contributor

recena commented Sep 24, 2015

@lanwen Why closed? /cc @jglick

@KostyaSha
Copy link
Member

Please read what GH wrote: @jglickjglick closed this in 03b1c87 8 minutes ago

@recena
Copy link
Contributor

recena commented Sep 24, 2015

@KostyaSha Thanks. I have to learn why this way is better (than traditional merge).

@KostyaSha
Copy link
Member

It not better, GH closes relevant PR when changes committed in target branch directly. Faster fix ourself instead of commenting and waiting for changes from PR author.

@recena
Copy link
Contributor

recena commented Sep 24, 2015

@KostyaSha ah ok. Thanks for your time.

JSONObject parsedPayload = fromObject(payload);
JSONObject repository = parsedPayload.optJSONObject("repository");
if (repository != null) {
// something like <https://github.com/bar/foo>
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure it matters, but not that this is not actually the form of the URL; it is something involving api.github.com.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jglick For that, there are GHEventsSubscriber validating the URL.

Copy link
Member Author

Choose a reason for hiding this comment

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

My point was just that the comment is wrong.

@jglick jglick deleted the PingGHEventSubscriber-organization branch September 24, 2015 13:46
@jglick
Copy link
Member Author

jglick commented Sep 24, 2015

GH closes relevant PR when changes committed in target branch

Well, when the special closes keyword is used in the squashed commit comment. It only treats the PR as having the merged status if the head commit of the PR actually becomes an ancestor of the head commit of the target branch, which will not happen when you squash.

@KostyaSha
Copy link
Member

Special keyword is not required. When diff has nothing GH closes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants