Skip to content

Github mirror of "labs/tools/gerrit-newcomer-bot" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)

License

Notifications You must be signed in to change notification settings

wikimedia/labs-tools-gerrit-newcomer-bot

Repository files navigation

gerrit-newcomer-bot

Gerrit newcomer bot for Wikimedia Foundation’s Gerrit code collaboration tool.

It helps DevRel’s in two ways – providing a solution to welcome newcomers and adding a process to query newcomer patches. It typically does two things:

  1. Add a reviewer (“Welcome, new contributor!”) to a patch submitted by a first time contributor and upload a welcome message in a comment
  2. Add contributors with five patches submitted only to a group called “Newcomers”. Then to query patches in Gerrit, you fetch by typing in the search terms:

Development

$ git clone git clone https://gerrit.wikimedia.org/r/labs/tools/gerrit-newcomer-bot.git
$ cd gerrit-newcomer-bot
$ pip3 install -r requirements
Copy gerrit.conf.example as gerrit.conf and enter your details
Drop your SSH host key in the project folder (name it as: ssh-host-key)
$ python3 watch_newcomers.py

For testing

  1. Register for an account on the test instance of Wikimedia's Gerrit. To register, you will have to sign up here to obtain the credentials
  2. Add your SSH keys to Gerrit
  3. While the watch_newcomers.py script is running in the background, clone a test repo and make some changes to it example repository
  4. To push changes to Gerrit: git push origin HEAD:refs/for/<branch-name>
  5. See the magic in action!

Note: If you want to use a different reviewer bot and not Welcome, new contributor!, you will have to create one using the same process as in Step 1.

For production

The bot is hosted here on Wikimedia's Toolforge: https://tools.wmflabs.org/admin/tool/gerrit-newcomer-bot. To make changes:

$ ssh [email protected]
$ become gerrit-newcomer-bot
$ cd /www/python/src

This bot uses Kubernetes deployment process detailed here https://wikitech.wikimedia.org/wiki/Help:Toolforge/Kubernetes#Kubernetes_continuous_jobs. To restart the bot, delete the failing kubernetes pod and create the deployment following the steps below:

$ kubectl delete deployment gerrit-newcomer-bot.bot
$ kubectl create -f /data/project/gerrit-newcomer-bot/etc/gerrit-newcomer-bot.yaml

Credits

About

Github mirror of "labs/tools/gerrit-newcomer-bot" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published