SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы
НазадМетки: buildbot
The GerritEventLogPoller class is similar to GerritChangeSource but connects to the Gerrit server by its HTTP interface and uses the events-log plugin.
Note that the decision of whether to use GerritEventLogPoller and GerritChangeSource will depend on your needs. The trade off is:
GerritChangeSource is low-overhead and reacts instantaneously to events, but a broken connection to Gerrit will lead to missed changes
GerritEventLogPoller is subject to polling overhead and reacts only at it’s polling rate, but is robust to a broken connection to Gerrit and missed changes will be discovered when a connection is restored.
You can use both at the same time to get the advantages of each. They will coordinate through the database to avoid duplicate changes generated for buildbot.
Note
The GerritEventLogPoller requires either the txrequest or the treq package.
The GerritEventLogPoller accepts the following arguments:
baseURLThe HTTP url where to find Gerrit. If the URL of the events-log endpoint for your server is https://example.com/a/plugins/events-log/events/ then the baseURL is https://example.com/a. Ensure that /a is included.
authA request’s authentication configuration. If Gerrit is configured with BasicAuth, then it shall be ('login', 'password'). If Gerrit is configured with DigestAuth, then it shall be requests.auth.HTTPDigestAuth('login', 'password') from the requests module. However, note that usage of requests.auth.HTTPDigestAuth is incompatible with treq.
handled_eventsEvent to be handled (optional). By default processes patchset-created and ref-updated.
pollIntervalInterval in seconds between polls (default is 30 sec).
pollAtLaunchDetermines when the first poll occurs. True = immediately on launch (default), False = wait for one pollInterval.
gitBaseURLThe git URL where Gerrit is accessible via git+ssh protocol.
get_filesPopulate the files attribute of emitted changes (default False). Buildbot will run an extra query command for each handled event to determine the changed files.
debugPrint Gerrit event in the log (default False). This allows to debug event content, but will eventually fill your logs with useless Gerrit event logs.
The same customization can be done as GerritChangeSource for handling special events.