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

Skip GitHubOrgWebHook.register when using a GH app receiving all relevant events #289

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

jglick
Copy link
Member

@jglick jglick commented Mar 24, 2020

See #269 (comment) for motivation.

Tested that events sent to the app do work, but did not test the code in this PR.

@@ -95,6 +95,7 @@ private static File getTrackingFile(String orgName) {
return new File(Jenkins.get().getRootDir(), "github-webhooks/GitHubOrgHook." + orgName);
}

// TODO never called?

Choose a reason for hiding this comment

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

The uninstallation of an app sends out an "action":"deleted" installation event, similar to installation of an app which also sends out an installation event but with "action":"created"

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes but AFAICT this Java method is not called.

Choose a reason for hiding this comment

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

Yeah looking at it, it might be designed to act on a deregister for a webhook, but I cannot find any such event for it on the Github API document :/

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the intention was for this to be called when the OrganizationFolder was deleted, but from e424aa2 I am guessing this was never implemented.

for (GHEventsSubscriber subscriber : GHEventsSubscriber.all()) {
@SuppressWarnings("unchecked")
Set<GHEvent> subscribedEvents = (Set<GHEvent>) eventsM.invoke(subscriber);
if (!handledEvents.containsAll(subscribedEvents)) {

Choose a reason for hiding this comment

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

This would make sure no events go unhandled :+1

Copy link
Member Author

Choose a reason for hiding this comment

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

It might be too strict—to activate this patch you need to include the repository events which you might otherwise have skipped if you are only dealing with a small list of repositories—but I erred on the conservative side.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this will break on PingGHEventSubscriber. Not yet tested.

docs/github-app.adoc Outdated Show resolved Hide resolved
@jglick
Copy link
Member Author

jglick commented Apr 13, 2020

I have not tried this yet. Has anyone else? @bitwiseman if you would like to get this in, I can try to do a sanity check.

docs/github-app.adoc Outdated Show resolved Hide resolved
@timja
Copy link
Member

timja commented Apr 13, 2020

I have not tried this yet. Has anyone else? @bitwiseman if you would like to get this in, I can try to do a sanity check.

I haven't tried it

@jglick
Copy link
Member Author

jglick commented Apr 15, 2020

Note that besides this plugin, org.jenkinsci.plugins.github.webhook.WebhookManager also attempts to register webhooks and should ideally be made to shut up.

@jglick
Copy link
Member Author

jglick commented Apr 15, 2020

…which would probably require moving support for Apps into github-api, as suggested in #291 (comment).

@jglick
Copy link
Member Author

jglick commented Apr 24, 2020

also attempts to register webhooks and should ideally be made to shut up

jenkinsci/github-plugin#225

@lifeofguenter
Copy link

This is related to #301 - e.g. currently a error message will popup not being able to create the webhook, even though the creation of that is not required

@bitwiseman
Copy link
Contributor

@timja @jglick I
Is this still a valid PR? Would it be possible to clean it up and get it merged so we can include it in the release before the tables-to-divs change?

@jglick
Copy link
Member Author

jglick commented Dec 23, 2020

I believe it remains valid, just never found the time to test it. No time to touch it before January.

@timja
Copy link
Member

timja commented Dec 24, 2020

@timja @jglick I
Is this still a valid PR? Would it be possible to clean it up and get it merged so we can include it in the release before the tables-to-divs change?

I think it’s still valid but probably not big enough to delay the tables to divs fix for it.

( the PR for retrieval via topics would be nice to look at though)

@bitwiseman
Copy link
Contributor

I have not updated this to deal with autoformatting.

The steps needed:

$ git merge task/formatting-base
$ mvnd spotless:apply && git commit -am "Apply autoformatting" && git merge -Xours upstream/master

@jglick
Copy link
Member Author

jglick commented Mar 4, 2021

$ git merge task/formatting-base
merge: task/formatting-base - not something we can merge

Huh? Do you just mean, say,

git pull origin master:master

resolve conflicts, reformat, and push?

@bitwiseman
Copy link
Contributor

@jglick
I had pushed the task/formatter-base to my fork rather than this upstream.
I made a branch that is only the pom.xml change from master. I merge that and make sure it compiles. The the second line is safe to do and will contain only the formatting changes.

@jglick
Copy link
Member Author

jglick commented Mar 5, 2021

I made a branch that is only the pom.xml change from master. I merge that

Like

git checkout master -- pom.xml

if the PR did not already touch the POM?

@bitwiseman
Copy link
Contributor

@jglick
Like that but also ensure that we've resolved all the potential non-formatting merge conflicts before making the formatting change.

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