This repository was archived by the owner on Jun 1, 2023. It is now read-only.
Conversation
3e9e681 to
d10b8e2
Compare
added 7 commits
September 3, 2016 23:32
We depend on workflow-multibranch so we can do more efficient job dispatching than owner.onSCMSourceUpdated(). That comes in the following commmit. We bump jenkins.version to get the static version of ParameterizedJobMixIn.scheduleBuild2
Returns a PR job name, or null if the source settings are such that we do not want to build it.
Extracted from doRetrieve to getGitHub, getRepository and opened access to isTrusted
Upon receiving a webhook for a multibranch project, we follow the same sort of process that branch indexing does: decide if there is a PR build that needs to happen, and schedule a build with the right name and revision. I'm not taking note of branch criteria here, nor even whether the jobs already exist. I'm not sure if that matters. Let's find out! :/
Added a method: generateRevisionForBranch. Now that I've discovered LogTaskListener, I should be able to reuse more of the GitHubSCMSource logic in the subscribers
The abstract base class is to hold common logic across both subscribers. The pull request subscriber generates an SCMRevision, if one is applicable, and schedules a build from it.
dde2ae8 to
cfa4496
Compare
cfa4496 to
ad81ccd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a fix for JENKINS-36121 that takes an opinionated approach.
owner.onSCMSourceUpdated()on webhooks; leaving it there, even as a fallback, on a busy repo, makes it too easy to hit rate limits. I've seen branch indexing churn and basically never sit idle. We can easily re-enable it as a fallback, however.GitHubWebhookListenerImplin favour of a newPushGHEventSubscriber(so that we get the webhook payload)AbstractGHEventSubscriberto hold common functionality between the PullRequest and Pull subscribersIn the
PullRequestGHEventSubscriber, each PR event webhook triggers up to two builds (merged/unmerged), and takes about one Github API request to do so (I think, namely checking the collaborators for.isTrusted?). Pushes to a PR that is already open won't yet trigger a build, I think. But editing the PR, or adding/removing a label should.In the
PushGHEventSubscriber, each push event webhook triggers a build of the relevant branch build. Again, very few, if any, GitHub API requests used.Altogether, the new behaviour is much better for large repositories than the linear-on-the-number-of-branches/PRs behaviour it used to have.
Problems for review
ParameterizedBuildMixin.scheduleBuild2; is that right?). I'm sure I'm missing some much easier way to schedule a multibranch subjob, but I don't know enough about the internals to find itGithubSCMSource; I've had to open a few too many internal methods on that class up. Probably just a matter of extracting the details of the task, observer, etc.? But this works for me for now. I think I did better in that respect for the Push subscriberComments welcome; my first Jenkins contribution, so sorry if there's anything unidiomatic. Consider reviewing commit by commit; I've tried to keep the changes logically grouped.
Edited 2016-09-03T09:16:00+00:00