# QtWaylandBot ## Purpose The QtWaylandBot is a webhook service designed to monitor Gerrit for changes to the `qt/qtbase` repository on the `dev` branch. Its primary function is to identify changes that modify Wayland-related files and include "Pick-to:" targets for Qt versions 6.9 or older. ## Actions When a relevant patchset is created that meets these criteria: 1. Targets the `qt/qtbase` project. 2. Is on the `dev` branch. 3. The change status is `NEW`. 4. Modifies files matching Wayland-specific patterns (e.g., in `/wayland/`, `/qtwaylandscanner/`). 5. The commit message contains a "Pick-to:" footer. 6. At least one of the "Pick-to:" targets is for Qt version 6.9 or an earlier version. The bot will: * Post a comment to the Gerrit change with `Sanity-Review: -1`. * The comment will explain that Wayland-related changes targeting these older versions must be manually backported to the standalone `qt/qtwayland` repository. If errors occur during processing, and a Microsoft Teams error webhook URL is configured, the bot will send a notification to the specified Teams channel. ## Configuration The bot is configured using environment variables: * `QTWAYLANDBOT_GERRIT_USERNAME`: (Required) The username for Gerrit authentication. * `QTWAYLANDBOT_GERRIT_PASSWORD`: (Required) The password or HTTP token for Gerrit authentication. * `QTWAYLANDBOT_PORT`: (Optional) The port on which the bot's web server will listen. Defaults to `8089`. * `QTWAYLANDBOT_TEAMS_ERROR_WEBHOOK_URL`: (Optional) The webhook URL for a Microsoft Teams channel where error notifications should be sent. If not set, error messages are only logged. * `QTWAYLANDBOT_TEAMS_WEBHOOK_URL`: (Optional) General Teams webhook URL (currently not used for specific notifications by the bot but available in config). ## Running the Bot The bot runs as an asynchronous web server. It is typically deployed as a system service. An example systemd service file (`qtwayland_bot.service`) is provided, which demonstrates how to run the bot using `pipenv`. The bot listens for HTTP POST requests (typically from Gerrit webhooks) on its root path (`/`) and provides a status endpoint at `/status`.