Repairnator Documentation
repository·master·Indexed 18 days ago
https://github.com/eclipse-repairnator/repairnatorAn open-source platform hosted by the Eclipse Foundation for developing and deploying software bots on GitHub. It focuses on automated program repair (APR) tasks, such as fixing build failures and static warnings. The platform includes a pipeline for cloning, building, and repairing programs, as well as scanners like RTScanner and FastScanner for detecting failing builds. It also supports SOBO, an automatic feedback bot for Java programs, and integrates with MongoDB for storing build statuses, metrics, and repair data.
What's inside Repairnator
- Repairnator is an open-source platform hosted by the Eclipse Foundation designed for software bots on GitHub. It specifically focuses on automated program repair (APR) tasks, such as repairing build failures and addressing static warnings (e.g., via SoraldBot).
Overview of Repairnator components
masterRepairnator is composed of several specialized modules that handle different stages of the software repair lifecycle:
- repairnator-core: Contains shared elements used across the platform. It can also be used to generate Google Spreadsheets Credentials.
- repairnator-pipeline: The core engine of Repairnator. It takes a build ID, performs compilation, testing, and repair, gathers data, and then pushes results to GitHub and MongoDB.
- repairnator-realtime: A monitoring component that inspects Travis builds in real-time (typically every minute).
- docker-images: Contains the content for the various Docker images produced for the platform.
- scripts: A collection of scripts used to run and automate Repairnator processes.
Overview of SOBO: automatic feedback bot
masterSOBO is an automatic feedback bot built on top of the Repairnator infrastructure. It provides hints to users on how to improve code quality. Currently, SOBO supports Java programs and uses Git for version control.Understand the structure of Bears data
masterThe Bears data repository contains information used to obtain bugs from GitHub repositories. The data is organized into project lists, scanned build pairs, and validated branches:
list-of-projects.txt: A text file containing the names of GitHub repositories used as sources for bugs.scanned-builds/: Contains pairs of builds scanned from the projects listed inlist-of-projects.txt. Each pair consists of a buggy build and its corresponding fixer build, intended to be reproduced to verify the bug/fix relationship.branches/: Contains information regarding branches generated via the Bears collection process. This folder is subdivided into:1-reproduced-build-branches/: Lists of branches generated from successfully reproduced build pairs.2-validation-results/: Lists of branches from the previous step that were reproduced a second time for validation. Branches are annotated with either[OK](successfully validated) or[FAILURE](unsuccessfully validated).3-successfully-validated-branches/: Lists of branches that achieved an[OK]status during the validation phase.
Understand the Repairnator Website Architecture
masterThe Repairnator website is a decoupled system designed to display statistics derived from a MongoDB instance containing Repairnator data. It consists of two primary components:
- repairnator-mongo-rest-api: A backend service that provides a REST-like API interface to the underlying MongoDB database.
- repairnator-site: A frontend application that consumes the REST API to visualize and display the data.
To deploy the full website experience, both the API and the site component must be operational and connected.
How the Repairnator Scanner works
masterScanners are daemons used to automate the detection of failing builds.
RTScanner: Constantly inspects Travis CI to catch newly failing builds and launch a pipeline for each.FastScanner: An alternative implementation of the same concept.
Scanners can be deployed in environments like Kubernetes.
How the Repairnator GitHub App works
masterThe app functions as a bridge between GitHub webhooks and the Repairnator pipeline via ActiveMQ:
- Webhook Listening: The server listens for GitHub events.
- Build Info Retrieval: For relevant events, the server requests build information from the Travis API.
- Queueing: For every failing Java build, the server pushes the
buildIdto a Repairnator ActiveMQ server. - Repair Pipeline: The
Repairnator-pipelineconsumes thebuildIdfrom ActiveMQ, invokes repair tools to generate patches, and if successful, creates a pull request on GitHub.
How Flacoco Scanner works
masterThe Flacoco Scanner (used by Flacocobot) performs fault localization on pull requests. It operates in two modes based on the configuration of the
FLACOCO_RESULTS_REPOSITORYenvironment variable:- Review Comment Mode: If
FLACOCO_RESULTS_REPOSITORYis NOT set, the scanner adds a review comment to the failing pull request if it finds suspicious lines within the PR's diff. It suggests the top 5 most suspicious lines by default. - Repository Mode: If
FLACOCO_RESULTS_REPOSITORYIS set to a GitHub repository slug, the scanner saves results as.MDfiles in that repository.- Files starting with
diff_contain suspicious lines found within the PR diff. - Other files contain the top 5 most suspicious lines found in the project generally.
- Files starting with
To specify which projects to scan, create a file containing one project slug per line (format:
<user>/<repo-name>) and set thePROJECTS_TO_SCAN_FILEenvironment variable to its path.- Review Comment Mode: If
How the Repairnator Pipeline works
masterThe pipeline is the core abstraction of Repairnator. It takes a Travis CI build ID as input and executes a sequence of steps: cloning the repository, building it, replicating the bug, and attempting repairs using various program repair tools. Finally, it can push the resulting branch or create a pull request.
The pipeline can be used directly in Java or encapsulated within a Docker image to provide a sandboxed environment with all necessary dependencies.
How to link data between different MongoDB collections
masterTo join or link data across different Repairnator collections, you must use the correct identifiers. Avoid using the standard MongoDB UUID, as it is unique to each collection and cannot be used for cross-collection linking.
Use the following strategy for linking:
- Build ID: This is the Travis ID of a specific build. While useful, be aware that the same Build ID might have been computed at different times.
- Run ID: This ID, when used in conjunction with the Build ID, guarantees the uniqueness of a specific computation.
Best Practice: Always use both
Build IDandRun IDtogether to ensure you are linking to the correct, unique computation instance.Compile the Repairnator Jenkins Plugin from source
masterTo build the plugin manually, navigate to the plugin directory and use Maven. The resulting
.hpifile will be located in thetarget/folder.cd src/repairnator-jenkins-plugin mvn install -DskipTestsSave MongoDB backups on librepair
masterOn the librepair machine, MongoDB backups are automatically performed every 24 hours via a cron job. Backups are stored in
/mnt/backup/repairnator/db. The backup script is located at/root/backup-repairnator.shand usesmongodumpwith the--gzipand--archiveflags to create dated compressed archives.mongodump -u *** -p *** --db repairnator --gzip --archive=/mnt/backup/repairnator/db/repairnator_`date +"%y-%m-%d"`.gz