Portal:Toolforge/Admin/Pywikibot image

This page documents the custom Pywikibot build service image.
* The image is built from https://gitlab.wikimedia.org/toolforge-repos/pywikibot-buildservice in the pywikibot tool.
== Updating the image ==
This needs to happen every time there is a new Pywikibot release.
* Clone the https://gitlab.wikimedia.org/toolforge-repos/pywikibot-buildservice repository
* Checkout the stable branch
$ git fetch --all
$ git checkout stable
$ git reset --hard origin/stable
* Fast-forward merge the pywikibot upstream stable branch release merge commit, in the image on the side, that'd be 018c420 (the first commit after the tag), push to gitlab
$ RELEASE_MERGE_COMMIT=018c420
$ git remote add pywikibot https://gerrit.wikimedia.org/r/pywikibot/core
$ git fetch -v pywikibot
$ git merge --ff-only $RELEASE_MERGE_COMMIT
$ git push origin stable
* Checkout the toolforge branch, and merge the stable branch to the toolforge branch, this will create a merge commit
$ git checkout toolforge
$ git reset --hard origin/toolforge
$ git merge stable
* Push toolforge branch to gitlab
$ git push origin toolforge
* Start a build (note that the image name is not the default)
tools.pywikibot@tools-sgebastion-11:~$ toolforge build start -i pywikibot-scripts-stable --ref toolforge https://gitlab.wikimedia.org/toolforge-repos/pywikibot-buildservice
== Doing a test ==
You can do a test using the tool wikitech-double-redirect-bot, that is setup to authenticate on wikitech:
tools.wikitech-double-redirect-bot@tools-sgebastion-10:~$ toolforge jobs run --image tool-pywikibot/pywikibot-scripts-stable:latest --command "pwb -family:wikitech -lang:en listpages -cat:Bots" test-image
tools.wikitech-double-redirect-bot@tools-sgebastion-10:~$ toolforge jobs logs test-image -f
2024-03-11T10:24:45+00:00 [test-image-8kxb7] family and mylang are not set.
2024-03-11T10:24:45+00:00 [test-image-8kxb7] Defaulting to family='wikipedia' and mylang='test'.
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 1 Asanack-bot
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 2 Bridgebot
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 3 Linkwatcher
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 4 Dbbot-wm
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 5 Gerrit/Phabricator integration
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 6 IRCD
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 7 Ircecho
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 8 Jouncebot
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 9 Logmsgbot
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 10 Meetbot
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 11 Morebots
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 12 Nagios-wm
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 13 Phab-ban
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 14 Phabricator/Conduit API Tokens
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 15 ReleaseTaggerBot
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 16 Stashbot
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 17 Wikibugs
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 18 WikiSVN
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 19 Wm-bot
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 20 Wprc
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 21 Zhmrtbot
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 
2024-03-11T10:24:47+00:00 [test-image-8kxb7] 21 read operations
2024-03-11T10:24:47+00:00 [test-image-8kxb7] Execution time: 
2024-03-11T10:24:47+00:00 [test-image-8kxb7] Read operation time: 0.0 seconds
2024-03-11T10:24:47+00:00 [test-image-8kxb7] Script terminated successfully.
== See also ==
* T249787 Create Docker image for Toolforge that is purpose built to run pywikibot scripts