Jump to content

Tool:Schedule-deployment

From Wikitech
Toolforge tools
Wikimedia Deployment Scheduler
Website https://schedule-deployment.toolforge.org/
Description Add a patch to an upcoming backport window on the Deployments calendar.
Keywords deployment, backports
Author(s) BryanDavis
Maintainer(s) BryanDavis (View all)
Source code gitlab
License GNU General Public License 3.0 or later
Issues Open tasks · Report a bug
Admin log Tools.schedule-deployment/SAL

Wikimedia Deployment Scheduler is a helper for scheduling a Gerrit change for deployment during an upcoming backport window.

Deployment

The tool is deployed as a Toolforge webservice running a build service managed container.

Rebuilding the image

Until we have an ability to configure automatic container builds, someone needs to ssh into a Toolforge bastion and kick off a new build when gitlab:toolforge-repos/schedule-deployment contains new code for release.

$ ssh dev.toolforge.org
$ become schedule-deployment
$ toolforge build start https://gitlab.wikimedia.org/toolforge-repos/schedule-deployment

Local development

Local development and testing are possible thanks to the magic of .env files to override default settings. The following settings will need to be overridden with a .env file in the root of your clone of the git repository:

MEDIAWIKI_DEPLOYMENTS_PAGE
Point this to a page in your User namespace where you have copied some revision of Deployments. User:BryanDavis/Sandbox/Deployments is the page BryanDavis uses for his testing.
MEDIAWIKI_CONSUMER_TOKEN, MEDIAWIKI_CONSUMER_SECRET, MEDIAWIKI_ACCESS_TOKEN, MEDIAWIKI_ACCESS_SECRET
Create an owner-only OAuth 1.0a consumer for some user account using Special:OAuthConsumerRegistration/propose. If you are a co-maintainer of the tool you can just copy the bot's credentials from toolforge envvars list.
GERRIT_USER, GERRIT_PASSWORD
Gerrit HTTP credentials for a developer account. If you are a co-maintainer of the tool you can just copy the bot's credentials from toolforge envvars list.
FEATURE_GERRIT_COMMENT=false
Disable posting comments back to Gerrit so that your local exploratory testing doesn't impact normal Gerrit activity.

The app can be run from the tox managed "py312" venv and accessed at http://localhost:8000/:

$ tox -e py212
py312: commands[0]> pytest
============================= test session starts ==============================
...snip...

============================== 13 passed in 0.58s ==============================
  py312: OK (0.96=setup[0.01]+cmd[0.95] seconds)
  congratulations :) (0.99 seconds)
$ .tox/py312/bin/deployments -vvv web
2024-08-08T09:50:35Z deployments.cli DEBUG: Invoking web
2024-08-08T09:50:35Z gunicorn.error DEBUG: Current configuration:
...snip...
2024-08-08T09:50:35Z gunicorn.error INFO: Starting gunicorn 22.0.0
2024-08-08T09:50:35Z gunicorn.error DEBUG: Arbiter booted
2024-08-08T09:50:35Z gunicorn.error INFO: Listening at: http://0.0.0.0:8000 (71748)
2024-08-08T09:50:35Z gunicorn.error INFO: Using worker: gthread
2024-08-08T09:50:35Z gunicorn.error INFO: Booting worker with pid: 71749
2024-08-08T09:50:35Z gunicorn.error DEBUG: 1 workers