Commit Graph

61 Commits

Author SHA1 Message Date
OpenDev Sysadmins d3cc74536e OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:26:00 +00:00
Zuul f32d742eff Merge "Add _get_username method to discover username" 2018-02-21 17:25:20 +00:00
Eric Fried 981dfa50fa Support regexes in channel config yaml
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
2018-02-17 11:35:39 -08:00
Eric Fried fc4041f6a3 Test Gerrit message filtering
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
2018-02-17 11:35:31 -08:00
John L. Villalovos 01e1a0f979 Add more unit tests including testing of Gerrit() class
* 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
2018-02-17 11:28:38 -08:00
John L. Villalovos 4658934d22 Add unit test framework and one unit test
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
2018-02-05 12:59:39 -08:00
Sorin Sbarnea 7050c81714 Removed unreasonable banning of newer pbr versions
Change-Id: I849de65d3d91447b9298be0b904dc0b5b419bbff
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2017-03-30 18:52:10 +01:00
Tristan Cacqueray 2240fc3450 Add _get_username method to discover username
This change mitigate this exception:
  File "gerritbot/bot.py", line 154, in change_created
    data['patchSet']['uploader']['name'],
KeyError: 'name'

Change-Id: Ia1f394d6ff0e158df16461cf3150761f6ec12f29
2017-03-15 02:09:49 +00:00
John L. Villalovos 033a83b870 For patch submitted/merged, announce the branch
When announcing that a patch has been submitted or merged, also announce
the branch that the patch is against.

Change-Id: I5b325951bdc1b0fca37d8579a14747a4da3b558e
2017-01-09 21:50:20 -08:00
James E. Blair 91d908b807 Treat channels as an LRU list
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
2016-11-02 12:03:42 -07:00
Matthew Treinish 7c6e57983d
Add gerrit stream over MQTT support to gerritbot
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
2016-08-11 17:32:07 -04:00
Joshua Hesketh d48b1bc417 Fix reconnection method
The reconnect method is on the connection object, not the bot or
client objects.

See http://paste.openstack.org/show/481770/

Change-Id: I14856c0c451e51973e9b062cb9b4f35362cb3766
2015-12-14 18:17:49 +11:00
Monty Taylor f907ae7054 Add a log entry to the debug log on config error
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
2015-09-20 19:33:09 -04:00
Jeremy Stanley 957981e7d8 Replace ci.o.o links with docs.o.o/infra
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
2015-05-14 21:38:16 +00:00
Monty Taylor 506aea9010 Replace six.iteritems with iter()
We don't need six for this.

Change-Id: I19673bf47ef74b5e67c4197d31600c73c025ab4c
2015-02-27 22:14:23 -05:00
Monty Taylor 4851742244 Update to modern pbr
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
2015-02-27 22:14:00 -05:00
Michael Krotscheck 976ce5abff Switched documentation to point to storyboard.
We've migrated this project to storyboard, I'm updating the documentation links.

Change-Id: I7f67c870bf1eef5b3ea29eb6880564f7aeb32e2e
2014-11-11 15:01:38 -08:00
Jenkins 9258586a86 Merge "Adding a configuration option for gerritbots PID file path." 2014-08-11 14:12:15 +00:00
Christian Berendt 8c38ecdb3f Cleaning up index.rst file
Removed notes about the generation of the file.

Change-Id: Ifefbb9ce4b76e22dd6ddb33658b4aa8469beff13
2014-07-21 08:29:05 +02:00
Christian Berendt 1143bda887 replace dict.iteritems() with six.iteritems(dict)
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
2014-07-10 19:16:48 +00:00
Tim Kelsey ed4e3d0b5c Adding a configuration option for gerritbots PID file path.
Closes-Bug: 1325583

Change-Id: I7200ae87963181e6ff8583ba665a141d7392605a
2014-06-02 14:48:34 +00:00
Matthew Montgomery 6208bd982f Force SSL Configuration Parameter
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
2014-05-23 08:39:55 -05:00
Ricardo Carrillo Cruz 575b062cbd Add support for notification of releases on IRC
Closes-Bug: #1227985

Change-Id: I9b80b465d9d6b0e2793286cc8229b82b4389a08d
2014-03-25 23:23:01 +00:00
James E. Blair cf56901920 Support SSL
Change-Id: I0c98febc3bdf15b0f92b749fd3b1afd3d0e1edbb
2014-03-10 08:29:58 -07:00
James E. Blair 4d99747b70 Don't crash on UTF8 errors
https://bitbucket.org/jaraco/irc/issue/34/irc-client-should-not-crash-on-failed

Change-Id: Ifb56ce80a170baf8c36a5fa1a2d0c88ea13885a5
2014-03-07 10:06:44 -08:00
Elizabeth Krumbach Joseph c67b4fcdce Some README fixups, including git url
Update git url to point to git.openstack.org and some language
fixes.

Change-Id: I4c27527b516ef3416e5a06b682b510550b4b1696
2014-03-05 12:40:05 -08:00
Matthew Treinish d2c5ba1cb0 Actually use super calls for init functions in bot.py
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
2014-01-13 19:53:48 +00:00
James E. Blair bcb72904de Reconnect to IRC on send error
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
2013-10-07 16:07:22 -07:00
Joe Gordon 14679c6f44 Make proposed and merged messages more terse
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
2013-08-06 18:39:32 -07:00
Monty Taylor d8969646f7 Remove dependency on distribute.
Change-Id: Id22f552dd67048b7f5b1f36d01dfe643e0a31e60
2013-07-05 21:12:44 -04:00
Jenkins e60ad273d0 Merge "Renamed requirements files to standard names." 2013-06-20 16:50:27 +00:00
Jenkins 07f4eddf7c Merge "Use flake8 instead pep8." 2013-06-20 16:50:26 +00:00
Jenkins 12a367b778 Merge "Migrate to pbr." 2013-06-20 16:49:45 +00:00
Jeremy Stanley a62ff34717 Pause between joins to avoid flooding.
* 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
2013-06-06 19:23:57 +00:00
Monty Taylor 71448ad1e3 Renamed requirements files to standard names.
Change-Id: I439587c38c012653d6313e1860c9b8612a58d544
2013-06-02 11:20:42 -04:00
Monty Taylor 95ecb0fb29 Use flake8 instead pep8.
Change-Id: I9dd305cf06157094ea49b2f30cb8f1d28d170b8c
2013-06-02 11:20:24 -04:00
Monty Taylor 6c07bb6bc6 Migrate to pbr.
Change-Id: Id9c9837b040c634103bcc30d590e995c3b6c309d
2013-06-02 10:37:00 -04:00
Elizabeth Krumbach 6563e96c89 Update online documentation link
README.rst referenced online documenation link that is now a 404, updated to
reflect current location

Change-Id: I2703520c82429272a0f669b1c5c8acfcd6bf2d5b
2013-01-09 14:06:01 -08:00
Jenkins 59bf12d70d Merge "Updated .gitreview location" 2012-12-16 20:29:53 +00:00
Jeremy Stanley 4a72743f4c Update README for project move.
* README.rst: Correct clone URL.

Change-Id: I5c89d101daab8ec70fc30ff8f0b10bfe7338812a
2012-12-16 19:34:22 +00:00
Monty Taylor 9c0ccbf033 Updated .gitreview location
Change-Id: I5fda46eef50e9d009bf71b9988ff08a42174e1c7
2012-12-16 10:40:29 -08:00
Jenkins 6d2dedfdd8 Merge "Create initial sphinx documentation" 2012-11-26 19:06:48 +00:00
Paul Belanger 1ffe945781 Create initial sphinx documentation
Change-Id: I79b4d880a8bf7021bb35b240ac040d78d78e3556
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
2012-11-25 19:27:01 -05:00
Monty Taylor 10ed743bb7 Remove sitepackages=true
We only need this for things that have non-virtualenv-able deps.

Change-Id: I78f85445d9a2e786f058f624b72c86d30066ed44
2012-11-23 16:39:56 -08:00
Erik Dalén 4959423fd1 Add support for server passwords
Change-Id: I0e623df8848b214ef715b2e265e97b71b16d666a
2012-11-05 12:38:42 -05:00
Clark Boylan 103f0987d0 Fix Gerritbot leaking GerritLib Threads.
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
2012-08-24 13:46:06 -07:00
Clark Boylan 92b7468921 Handle KeyErrors when event data is not present.
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
2012-08-24 13:28:46 -07:00
Clark Boylan 383860d352 Log useful information.
Logging was configured, but only gerritlib log info was captured. Add
logging to the things that the IRC bot is doing.

Change-Id: Id38e49d95c2903ae28cfb7f2dc88d4fc201d8927
2012-08-24 11:51:06 -07:00
Clark Boylan 21b5546061 Remove Nova's description from setup.py.
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
2012-08-15 13:48:55 -07:00
Jenkins cc8a524003 Merge "Add a README file." 2012-08-03 16:34:20 +00:00