< Reading < Web

Setup

  • Setup a Gerrit account on wikitech and setup a labs instance
  • On the labs instance clone the repo that makes use of a build step e.g. Popups extension
  • Upgrade npm to 6
    • Install nvm
    • nvm install 6.11.0
      nvm use
      x ~/git/rebasebot $ node -v
      v6.11.0
      
  • Install git review (I recommend via the pip method on Linux)
    • Setup gerrit branch making sure you use ssh
      git remote add gerrit ssh://<username>@gerrit.wikimedia.org:29418/<project>.git
      git remote set-url gerrit ssh://<username>@gerrit.wikimedia.org:29418/<project>.git
      
    • Before going any further ensure you can run `git commit && git review` without errors.
      touch x.test
      git add x.test
      git commit
      git review
      
      In some repos you may find you need to add composer support for the precommit hook
      sudo php composer-setup.php --install-dir=/usr/bin --filename=composer
      composer install
      # possibly needed
      # sudo apt-get install php-mbstring
      # sudo apt-get install php-xml
      

    • If your labs instance differs from your Gerrit username edit ~/.ssh/config
    • Make sure your public key is valid for running:
      ssh -p 29418 gerrit.wikimedia.org gerrit stream-events
      
  • 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
    git config --global user.email "john@doe.org"
    
  • If calling
    ssh -p 29418 gerrit.wikimedia.org gerrit stream-events
    
    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
export PIXIES_HOME=/home/pixies/
cd $PIXIES_HOME/barrybot/Popups #this is the repo you want to auto-rebase for
screen -c $PIXIES_HOME/pixies.conf -dmSL pixie $PIXIES_HOME/barrybot/pixies.py --project mediawiki/extensions/Popups
  • 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/
# check manually that the git repo is in a healthy state
cd /home/pixies/
./up_pixie.sh # this launches a `screen` where Barry will watch for rebase commands

Folder structure

Folder structure is

  • barrybot
    • pixies.py
    • Popups <working git repo to be targeted with git review setup>
  • 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.
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.