Reading/Web/Pixie.py rebase tool

Setup

 * Setup a Gerrit account on wikitech and setup a labs instance
 * The web team uses BarryTheBrowserTestBot or Frankiebot
 * Make sure you setup your Gerrit public key
 * Make sure your user is in the stream-events Gerrit group or non-interactive user group
 * Talk to release engineering (use irc) to request this permission.
 * On the labs instance clone the repo that makes use of a build step e.g. Popups extension
 * Upgrade npm to 6
 * Install nvm
 * Install git review (I recommend via the pip method on Linux)
 * Setup gerrit branch making sure you use ssh
 * Before going any further ensure you can run `git commit && git review` without errors. In some repos you may find you need to add composer support for the precommit hook
 * Before going any further ensure you can run `git commit && git review` without errors. In some repos you may find you need to add composer support for the precommit hook


 * If your labs instance differs from your Gerrit username edit ~/.ssh/config
 * Make sure your public key is valid for running:
 * If in doubt, find your bot's username here: https://gerrit.wikimedia.org/r/#/settings/
 * You may need to update your bot's git email address via
 * If calling  reports "Capability streamEvents is required to access this resource" you'll need to get added to the correct Gerrit group by release engineering (use irc).

Running

 * Clone pixies.py on your labs instance
 * Save the following in a sh file e.g. up_pixie.sh
 * Cross fingers!

In action
If set up correctly:
 * Play Debaser by the pixies (adds to the magical effect)
 * Go to a patch in the repo you just setup your bot for that has a rebase conflict that Gerrit cannot take care of.
 * Either +2 it or comment with "rebase" (a bit like "recheck" for Jenkins)
 * Watch the magic unfold.

Rebooting
An instance runs on reading-web-staging-3.eqiad.org under the pixies username. After sshing in there

Reboot: sudo su mwvagrant cd /home/pixies/ cd barrybot/ cd /home/pixies/ ./up_pixie.sh # this launches a `screen` where Barry will watch for rebase commands
 * 1) check manually that the git repo is in a healthy state

Folder structure
Folder structure is
 * barrybot
 * pixies.py
 * Popups 
 * pixies.conf
 * up_pixie.sh

up_pixie.sh: cd $HOME/barrybot/Popups #this is the repo you want to auto-rebase for screen -c $HOME/pixies.conf -dmSL pixie $HOME/barrybot/pixies.py --project mediawiki/extensions/Popups

pixies.conf: logfile pixiep.log logfile flush 1 log on logtstamp after 1 logtstamp string "[ %t: %Y-%m-%d %c:%s ]\012" logtstamp on

Debugging

 * Debugging information is passed to pixies.log
 * The bot should comment shortly after your rebase command with a "message received master!" to tell you that it's attempting to grant your request or reject swiftly if not possible.