|
1 | | -# failman |
2 | | -Buildbot failed builds reporter |
| 1 | +# Buildbot Failed Builds Reporter |
| 2 | + |
| 3 | +This script collects the latest failed builds from a [Buildbot](https://buildbot.net/) instance, generates both an **HTML report** and a **CSV file**, and sends them via email using an SMTP relay (IP-based authentication). |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- ✅ Fetches builders and latest builds per branch from the Buildbot API |
| 8 | +- ✅ Filters builds by branch and builder names. See Config. |
| 9 | +- ✅ Identifies **failed builds** |
| 10 | +- ✅ Generates: |
| 11 | + - HTML tables grouped by branch |
| 12 | + - A CSV report with details for each failed build |
| 13 | +- ✅ Sends an email with both the HTML report (inline) and the CSV as an attachment |
| 14 | +- ✅ SMTP relay connection with **IP-based authentication** (no login required) |
| 15 | + |
| 16 | +## Requirements |
| 17 | + |
| 18 | +- Buildbot REST API (v2) accessible |
| 19 | +- SMTP relay server accessible from the host machine |
| 20 | +- [Google Workspace SMTP relay](https://support.google.com/a/answer/176600?hl=en) or similar |
| 21 | + |
| 22 | +## Config |
| 23 | + |
| 24 | +- the configuration file can be either a local file or a URL. To use an URL set `CONFIG_URL` in the `.env` file |
| 25 | +- `branches` list for making calls to buildbot `/changes` api and retrieve the latest builds per branch |
| 26 | +- `builder_filter` empty to get results for all builders from the `/builders` API |
| 27 | + |
| 28 | + |
| 29 | +## How to run |
| 30 | + |
| 31 | +Set according to your setup: |
| 32 | +``` |
| 33 | +SENDER=#SENDER_EMAIL# |
| 34 | +RECIPIENT_EMAIL=#RECEIVER_EMAIL# |
| 35 | +SMTP_RELAY_SERVER=smtp-relay.gmail.com |
| 36 | +SMTP_RELAY_PORT=465 |
| 37 | +BASE_BUILDBOT_URL=#BUILDBOT BASE URL# |
| 38 | +``` |
| 39 | + |
| 40 | +```bash |
| 41 | +pip install -r requirements.txt |
| 42 | +python3 failman.py |
| 43 | +``` |
| 44 | + |
| 45 | +Or in `Docker` as a scheduled event. Set the desired schedule in `crontab` |
| 46 | +``` |
| 47 | +docker build -t failman . |
| 48 | +docker run -d --name failman failman |
| 49 | +``` |
| 50 | + |
| 51 | +The repository default `config.yaml` is present in the image and used when no |
| 52 | +`CONFIG_URL` is set in the `.env` file. |
| 53 | + |
0 commit comments