Skip to content

Commit 8677cac

Browse files
committed
Add a automatic PR-revert utility for failing buildbots
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
1 parent a22bbf3 commit 8677cac

File tree

4 files changed

+470
-0
lines changed

4 files changed

+470
-0
lines changed

buildbothammer/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# BuildbotHammer
2+
3+
This app automatically creates revert Pull Requests for failing builds in the
4+
CPython project. It monitors Buildbot for failing builds, identifies the
5+
commit that caused the failure, and creates a revert PR on GitHub. It also sends
6+
notifications to Discord.
7+
8+
## Prerequisites
9+
10+
- Python 3.11+
11+
- Git
12+
- A GitHub account with fork of the CPython repository
13+
- A Discord server with webhook set up (for notifications)
14+
15+
## Installation
16+
17+
1. Clone this repository:
18+
```
19+
git clone https://github.com/python/buildmasterconf.git
20+
cd buildmasterconf/buildbot-hammer
21+
```
22+
23+
2. Install the required Python packages:
24+
```
25+
pip install -e .
26+
```
27+
28+
3. Set up environment variables:
29+
```
30+
export GITHUB_TOKEN="your-github-personal-access-token"
31+
export DISCORD_WEBHOOK_URL="your-discord-webhook-url"
32+
```
33+
34+
4. Update the script with your GitHub username:
35+
Open the script and replace `FORK_OWNER` variable with your GitHub username.
36+
37+
5. (Optional) Update the `REPO_CLONE_DIR` path if you want to use a different location for the local CPython clone.
38+
39+
## Usage
40+
41+
Run the script with:
42+
43+
```
44+
python -m buildbothammer
45+
```
46+
47+
The script will:
48+
1. Check Buildbot for failing builds
49+
2. For each failing build, it will:
50+
- Identify the commit that caused the failure
51+
- Create a new branch in your fork
52+
- Revert the problematic commit
53+
- Create a Pull Request to the main CPython repository
54+
- Send a notification to the configured Discord channel
55+
56+
## Configuration
57+
58+
- `BUILDBOT_API`: The Buildbot API endpoint (default: "http://buildbot.python.org/api/v2")
59+
- `BUILDBOT_URL`: The Buildbot URL for generating links (default: "http://buildbot.python.org/#/")
60+
- `REPO_OWNER`: The owner of the main repository (default: "python")
61+
- `REPO_NAME`: The name of the repository (default: "cpython")
62+
- `FORK_OWNER`: Your GitHub username (default: "$REPO_OWNER")
63+
- `REPO_CLONE_DIR`: The directory for the local clone of the repository

buildbothammer/pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[project]
2+
name = "buildbothammer"
3+
version = "0.1.0"
4+
description = "Automatic revert failing CPython PRs"
5+
readme = "README.md"
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"requests>=2.32.3",
9+
"pygithub>=2.4.0",
10+
"filelock>=3.16.1",
11+
"aiohttp",
12+
]
13+
14+
[build-system]
15+
requires = ["hatchling"]
16+
build-backend = "hatchling.build"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy