|
| 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 |
0 commit comments