With this change, the channel config yaml file can now be configured to
support regular expressions.
Any value in any section may be prefixed with `^` to denote that it is
to be treated as a regular expression [1]. Start and end ^anchors$ are
implicit (so add `.*` if needed).
For example, given the following paragraph in the channel config yaml:
openstack-foo:
events:
- patchset-created
- change-merged
projects:
- openstack/foo
- ^openstack/foo-.*
- openstack/oslo.foo
branches:
- master
- ^stable/(newton|ocata|pike)
...messages will be posted to #openstack-foo for events coming in from
project openstack/foo, openstack/foo-one, openstack/foo-bar, etc.; on
branches master, stable/newton, stable/ocata, or stable/pike.
Behavior is unchanged for values not prefixed with `^`.
[1] This paradigm cribbed from gerrit's search functionality:
https://review.openstack.org/Documentation/user-search.html#path
Change-Id: I97cb8faa72600bd1bd9792bb6bb59a3b652ec389
Enhance the tests introduced in [1] to exercise the filtering logic in
the Gerrit class.
[1] https://review.openstack.org/#/c/545128/
Change-Id: Ib4ecd9e7ee233378f25d585f016ba1448b9e8797
* Add some additional unit tests, including the initial framework to
be able to test the Gerrit() class.
* Improve the readability of the code by using more descriptive
variable names.
* Migrate to using '.stestr.conf' instead of '.testr.conf'. This
removes warning message that was being displayed.
Change-Id: I596c4ccb9fe37d996de26089eefd8481a12ff13b
Add an initial unit test framework and one unit test. This way we can
ask people to add unit tests when they contribute code.
Change-Id: If52976e1992945a8e38af3cbad5b5f4389922d4c
This change mitigate this exception:
File "gerritbot/bot.py", line 154, in change_created
data['patchSet']['uploader']['name'],
KeyError: 'name'
Change-Id: Ia1f394d6ff0e158df16461cf3150761f6ec12f29
When announcing that a patch has been submitted or merged, also announce
the branch that the patch is against.
Change-Id: I5b325951bdc1b0fca37d8579a14747a4da3b558e
Freenode has a limit of 120 channels joined by a single connection.
Since some of the channels Gerritbot reports to are less active
than others, have it only join channels when it needs to send a
message. If it has joined the max number of channels, part from
the least recently used channel to make room to join a new one.
Change-Id: Ifafeed77e640bc7b5910251c619358a8a2bd78a6
With the start of the germqtt project and it being deployed on
firehose.openstack.org services listening to gerrit no longer need
to connect via ssh to get the event stream. This commit adds support
for using an mqtt event stream as the input into gerritbot.
Change-Id: I4130edac746ab7ae979cad5e3ccad3be0321c909
The reconnect method is on the connection object, not the bot or
client objects.
See http://paste.openstack.org/show/481770/
Change-Id: I14856c0c451e51973e9b062cb9b4f35362cb3766
Recently a config problem broke gerritbot's ability to start, but what's
worse, there was no logging about why. Log the exception when this
happens.
Change-Id: If7832cbe5cbf5f506d5dfbb849f05f2e7670a2df
The http://ci.openstack.org/ documentation site has been deprecated,
replaced by redirects to corresponding paths within
http://docs.openstack.org/infra/ where other Project Infrastructure
documentation already resides.
Change-Id: Icb976e2ec63dd8bcbb5890353ff980a4013d9a8a
d2to1 hasn't been a thing in a VERY long time. We have to update hacking
as well beause the hacking this depends on also depends on a very old
pbr.
Change-Id: I1bf97a5fe1c1ae10f951510c2b95d43b4e9b8b19
According to https://wiki.openstack.org/wiki/Python3 dict.iteritems()
should be replaced with six.iteritems(dict).
Added six >= 1.6.0 as new requirement.
Change-Id: Ie8a3eacc00dd9248ee80956b3e72f0e80655b1f1
Adds a new optional config parameter "force_ssl" that applies the SSL wrapper
regardless of the specified port. The previous logic only allowed for SSL
on port 6697. This change is intended to be backwards compatible with
existing configs.
Added *.egg ignore patterns to .gitignore
Change-Id: I6fe6d9ad2d8461d759a63123af79f229b8f8b6f2
This commit fixes the gerritbot __init__ methods to use a proper super
call instead of directly calling the parent class's __init__.
Change-Id: I72894a978b7bcef782236f5d43f601697a89c50d
If any error is encountered while sending to IRC, try to reconnect.
This is an attempt to deal with this exception:
2013-10-07 23:00:00,937 ERROR gerritbot: Exception encountered in event loop
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gerritbot/bot.py", line 225, in run
self._read(event)
File "/usr/local/lib/python2.7/dist-packages/gerritbot/bot.py", line 216, in _read
self.change_merged(channel, data)
File "/usr/local/lib/python2.7/dist-packages/gerritbot/bot.py", line 194, in change_merged
self.ircbot.send(channel, msg)
File "/usr/local/lib/python2.7/dist-packages/gerritbot/bot.py", line 98, in send
self.connection.privmsg(channel, msg)
File "/usr/local/lib/python2.7/dist-packages/irc/client.py", line 933, in privmsg
self.send_raw("PRIVMSG %s :%s" % (target, text))
File "/usr/local/lib/python2.7/dist-packages/irc/client.py", line 960, in send_raw
sender = self.ssl.write if self.ssl else self.socket.send
AttributeError: 'NoneType' object has no attribute 'send'
Change-Id: I8c845626260ec7b9ee7f9e409adba4796dd367ee
The previous messages were wordy, when gerrit is very active, all these
wordy messages can clutter up a room. This makes the messages more
terse.
Change-Id: I7c941a871e3f1a09dd47c72aa32f93effc04250a
* gerritbot/bot.py(GerritBot.on_welcome): Add a 0.5-second pause
between channel join commands to avoid being kicked for flooding.
Change-Id: I8edad4b389683e62b58f5b6e81e5f4cb1e0dad97
README.rst referenced online documenation link that is now a 404, updated to
reflect current location
Change-Id: I2703520c82429272a0f669b1c5c8acfcd6bf2d5b
Gerritbot previously leaked GerritLib threads because it did not check
if the preexisting thread was dead before starting new threads. Fix
that by checking the thread's is_alive() method.
Change-Id: I7282debf5caeb73cbc46b240f10c62b75b683776
The bot previously assumed that all event stream JSON blobs would always
have the data that the bot is interested in. Handle KeyError exceptions
when that data is missing.
Change-Id: I6ad034c5197c6778c39c334e3d9246c3b1356a81
Logging was configured, but only gerritlib log info was captured. Add
logging to the things that the IRC bot is doing.
Change-Id: Id38e49d95c2903ae28cfb7f2dc88d4fc201d8927
There was a copy pasta fail and Nova's project description was in
GerritBot's setup.py. Replace that description with one for GerritBot.
Change-Id: I92011d228cd35db93febb8eaefa5e576adeccfef