Commit Graph

10 Commits

Author SHA1 Message Date
Radosław Piliszek 75e2c2f03d Add branch to all the remaining event messages
Branch is always useful to know. ;-)

Change-Id: Icece8d06c771dbd55825655206f75810d9fa43e6
2021-04-28 18:39:09 +00:00
Jeremy Stanley 225a6a3502 Revert "Skip notifications about WIP changes"
Needs more discussion.

This reverts commit 54e2f218d6.

Change-Id: I7fd6b8f78830cc87d14b67d957fa64cc0d453c0b
2021-01-19 19:26:45 +00:00
Zuul e3bcd8a4e9 Merge "Skip notifications about WIP changes" 2021-01-19 15:46:11 +00:00
Sorin Sbarnea 7d473e4d43 Use yaml.safe_load instead of load.
Fixes security issue and deprecation of simple use of yaml.load
without an explicit loader.

Change-Id: If47e3fd1cc09c7a1db1fad05a643aa3da04cf26c
2020-12-02 16:51:28 +00:00
Sorin Sbarnea 54e2f218d6 Skip notifications about WIP changes
WIP changes are likely to spam irc channels as they are not even
visible by default in dashboards. If we detect the WIP flag as present
and set to true, we just skip doing anything about that message.

Change-Id: Id4ee6c825e6d508c0c722d01ac8b1147b4025dbe
2020-12-02 15:32:09 +00:00
Steve Baker e3879412b7 Fix event comment-added
This change fixes the comment-added message sending to filter by the
event type which gerrit is now sending (Verified and Code-Review)

Adding the following to project-config/gerritbot/channels.yaml will
restore the previous functionality of sending messages for Verified,
Code-Review +2 and -2:

  events:
    - comments-added
    - x-vrif-minus-2
    - x-vrif-plus-2
    - x-crvw-minus-2
    - x-crvw-plus-2

Additionally, specifying 'comments-added' will send a message for
*every* gerrit comment, so the only way to get messages for
x-vrif-plus-2 (for example) is to also receive a firehose of every
gerrit comment.

To make this more configurable, the event type x-all-comments has been
added, which is now required in combination with 'comments-added' to
send a message for every gerrit comment:

  events:
    - comments-added
    - x-all-comments

Change-Id: I9971e045c3416b300d1fd4683a2c145afef3d44f
2019-12-10 10:49:01 +13: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