wikibugs
wikibugs is an IRC bot that idles in the #wikimedia-dev connect development channel (and others) on the Libera Chat IRC network.
After restart, the bot joins only #wikimedia-cloud connect by default. Other channels are joined when the first relevant message to them is supposed to be sent.
Components
[edit]The bot is a collection of scripts that exchange messages via a central webservice. Multiple source jobs read data from various feeds and push data into a queue for broadcast to IRC channels. A single IRC client job receives events from the queue and sends messages to IRC. To help with all of the sorts of things that can go wrong with IRC connections and flooding, the IRC client uses a bouncer as a buffer between it and the Libra.Chat IRC network.
wikibugs2 gerrit
- Listen to a Gerrit instance's stream-events ssh data feed and put formatted IRC messages built from selected events to
wikibugs2 web
. wikibugs2 gitlab
- Listen to Server-Sent Events (SSE) produced by the gitlab-webhooks tool and put formatted IRC messages built from selected events to
wikibugs2 web
wikibugs2 irc
- Process structured data from
wikibugs2 web
SSE and send formatted IRC messages to configured channels. wikibugs2 phorge
- Poll a Phorge (formerly Phabricator) instance's feed.query Conduit API and put selected events to
wikibugs2 web
. wikibugs2 web
- Configuration server for gerrit and phorge channelfilters. Event collection and redistribution.
wikibugs2-znc
- Run a ZNC IRC bouncer to proxy connections to the Libera Chat IRC network for
wikibugs2 irc
.
Source
[edit]The source for wikibugs can be found in GitLab:
- https://gitlab.wikimedia.org/toolforge-repos/wikibugs2
- https://gitlab.wikimedia.org/toolforge-repos/wikibugs2-znc
The channels list and gerrit-channels list in the wikibugs2 repo are the most commonly edited configuration files.
Configuring channels
[edit]Update channels.yaml or gerrit-channels.yaml with the channel name and project name. Project names can be regular expressions and are case insensitive. For the most part, this is self-serve and up to the people who operate and participate in each individual channel. Many people have +2 on the repository, if you are trusted, please ask and we can add you.
Note that before wikibugs can be added to a new channel, it must be autovoiced in that channel to avoid issues with the ozone anti-spam bot (T283983). Please do not merge changes which add wikibugs to a new channel until a wikibugs maintainer has checked this step.
IRC channel operators can do: /msg chanserv flags <#channel> wikibugs +Vv
to set the correct flags.
Deploying changes
[edit]You need to ssh into login.toolforge.org and run the following commands:
$ become wikibugs # sudo -i become wikibugs if you're in sudoers but not a member of tools.wikibugs
$ webservice status
Your webservice of type buildservice is running on backend kubernetes
$ toolforge jobs list
+-----------+------------+---------+
| Job name: | Job type: | Status: |
+-----------+------------+---------+
| gerrit | continuous | Running |
| gitlab | continuous | Running |
| irc | continuous | Running |
| phorge | continuous | Running |
| znc | continuous | Running |
+-----------+------------+---------+
To deploy new code changes, first build a new container image:
$ toolforge build start https://gitlab.wikimedia.org/toolforge-repos/wikibugs2
Then restart jobs as needed:
$ webservice restart
$ toolforge jobs restart gerrit
$ toolforge jobs load --job gerrit wikibugs2/toolforge-jobs.yaml # hard stop/start
The debug log output from all jobs components can be tailed with this Kubernetes command:
$ kubectl logs --all-containers=true --ignore-errors --max-log-requests 10 --prefix=true \
--since=10m --follow \
--selector 'app.kubernetes.io/name in (gerrit, gitlab, irc, phorge, znc)'
Muting wikibugs
[edit]There is currently no IRC-based method for this. Maintainers can kill the Phabricator listener via:
user@tools-bastion-03:~$ become wikibugs
tools.wikibugs@tools-bastion-03:~$ toolforge jobs delete phorge
To recreate a deleted job:
user@tools-bastion-03:~$ become wikibugs
tools.wikibugs@tools-bastion-03:~$ toolforge jobs load --job phorge wikibugs2/toolforge-jobs.yaml
Check wikibugs server log
[edit]Making wikibugs ignore certain users
[edit]Parts of this page (those related to ignoring users) are outdated. |
In the case of a vandal attacking Phabricator, you likely want to quietly cause the bot to drop their messages (so Libera Chat stops killing the bot for flooding) without giving them the recognition of a commit.
In src/wikibugs2/irc.py
, there is a function named handle_useful_info
with an "ignored" tuple in it. Add the username to the tuple and restart the irc job as normal (see Restarting wikibugs above). Then let it run for a while until the vandal's account has been disabled and all their messages have been popped from the event queue. Then reverse the change.
During this it will still be processing their Phabricator edits behind the scenes so depending on volume it may be slow to post things to IRC.
Help
[edit]Find any of the following friendly people on IRC and they should be able to help you out:
- bd808
- legoktm
- valhallasw
List of people who have maintainer access to the bot.
History
[edit]The first wikibugs, started in August 2004, was a Perl script that parsed Bugzilla's email messages, wrote them to a log file, and relied on ircecho to post them. In April 2014, the bot was rewritten in Python ("pywikibugs"), still parsing email messages, but using a Redis queue to post on IRC. Later in November 2014, the bot was rewritten again ("wikibugs2"), this time handling bugs from Phabricator rather than Bugzilla, but reused many of the ideas from pywikibugs such as a Redis queue and asyncio. In 2021, the bot left Freenode and moved to Libera Chat. In 2024 the bot's code was refactored to work as a Python package with a "__main__" entrypoint, the Redis dependency was removed, and an initial integration with gitlab.wikimedia.org was added.