Skip to content

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

Draft
jglick wants to merge 10 commits into
jenkinsci:masterfrom
jglick:app-webhooks
Draft

Skip GitHubOrgWebHook.register when using a GH app receiving all relevant events#289
jglick wants to merge 10 commits into
jenkinsci:masterfrom
jglick:app-webhooks

Conversation

@jglick

@jglick jglick commented Mar 24, 2020

Copy link
Copy Markdown
Member

See #269 (comment) for motivation.

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

return new File(Jenkins.get().getRootDir(), "github-webhooks/GitHubOrgHook." + orgName);
}

// TODO never called?

Copy link
Copy Markdown

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
Copy Markdown
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.

Copy link
Copy Markdown

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
Copy Markdown
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)) {

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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.

Comment thread docs/github-app.adoc Outdated
Co-Authored-By: Liam Newman <bitwiseman@gmail.com>
@jglick

jglick commented Apr 13, 2020

Copy link
Copy Markdown
Member Author

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.

Comment thread docs/github-app.adoc Outdated
Co-Authored-By: Tim Jacomb <timjacomb1+github@gmail.com>
@timja

timja commented Apr 13, 2020

Copy link
Copy Markdown
Member

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

jglick commented Apr 15, 2020

Copy link
Copy Markdown
Member Author

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

jglick commented Apr 15, 2020

Copy link
Copy Markdown
Member Author

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

@jglick

jglick commented Apr 24, 2020

Copy link
Copy Markdown
Member Author

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

jenkinsci/github-plugin#225

@lifeofguenter

Copy link
Copy Markdown

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
Copy Markdown
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

jglick commented Dec 23, 2020

Copy link
Copy Markdown
Member Author

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

@timja

timja commented Dec 24, 2020

Copy link
Copy Markdown
Member

@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
Copy Markdown
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

jglick commented Mar 4, 2021

Copy link
Copy Markdown
Member Author
$ 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
Copy Markdown
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

jglick commented Mar 5, 2021

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

5 participants