Tool:Officewikibot

From Wikitech
Toolforge tools
OfficeWikiBot
Website https://toolsadmin.wikimedia.org/tools/id/officewikibot
Description Bot for doing boring maintenance things on the Wikimedia Foundation staff wiki.
Keywords pywikibot
Author(s) BryanDavis
Maintainer(s) BryanDavis (View all)
Source code gitlab
License GNU General Public License 3.0 or later
Admin log Tools.officewikibot/SAL

Officewikibot runs Pywikibot scripts to automate maintenance tasks on the Wikimedia Foundation staff wiki.

Deployment

The bot is deployed as a collection of Toolforge scheduled jobs each running a build service managed container. This container is a variant of the image used to run Pywikibot built-in scripts by other tools. The image has been tweaked to support bot password authentication because officewiki does not currently support the OAuth authentication method used by project wiki bots.

Updating the image

This should happen following each Pywikibot upstream release.

  1. Wait for the upstream Pywikibot image to be updated.
  2. Update our toolforge branch to match the upstream toolforge branch.
  3. Create a merge request to update our main branch with the upstream changes as a new merge commit.
  4. Land the merge request.
  5. Start a build of the new container image:
    $ toolforge build start https://gitlab.wikimedia.org/toolforge-repos/officewikibot-pywikibot
    

Scheduled jobs

Jobs descriptions are maintained in $HOME/jobs.yaml:

$HOME/jobs.yaml
---
- name: fix-double-redirects
  command: pwb -family:officewiki redirect both -moves -always
  image: tool-officewikibot/tool-officewikibot:latest
  no-filelog: true
  emails: all
  schedule: '@weekly'

Configuration

The scripts use twelve-factor app style config via environment variables. In Toolforge this configuration is managed with the toolforge envvars command.

$ toolforge envvars list
name                   value
PWB_BOTPASSWORD        <redacted>
PWB_BOTPASSWORDNAME    toolforge
PWB_USERNAME           Officewikibot
TOOL_REPLICA_PASSWORD  <redacted>
TOOL_REPLICA_USER      s54975
TOOL_TOOLSDB_PASSWORD  <redacted>
TOOL_TOOLSDB_USER      s54975

See also