GithubHelp home page GithubHelp logo

rebazer

Build Status Sonarcloud Status license PRs welcome code with hearth by retest

Helper service to handle pull requests (PRs) on GitHub or Bitbucket. Primary it rebases the source branch of PRs against target branch to streamline commit history.

The rebazer polls in a configurable interval GitHub and Bitbucket repositories. The processing for each repository is described below:

  • Has PR changed since last run?
    • If no wait again for source/target branch, build result or approval change
  • Is the corresponding build green?
    • If no wait again for green build
  • Is source branch on top of target branch?
    • Rebase source branch
    • Conflict while rebasing?
      • On conflict abort rebase and comment PR
    • Wait for green build
  • Is PR approved?
    • Wait for approval
  • Merge PR into
  • Delete merged branch

Illustrated as a flowchart:

rebazer flowchart

Configuration

The rebazer relies on several parameters to configure the handled repositories. The configuration can be specified in any way supported by spring boot. Recommended is to use a application.yml file. The roll out of the application.yml depends on type of deployment.

Minimal configuration example:

rebazer: hosts: - type: GITHUB teams: - name: your_company user: service_user pass: dont_use_this_pass_at_home repos: - name: foo - name: bar

An example in-depth can be found in application-example.yml.

Mandatory parameter

Parameter Explanation
rebazer.hosts[ ].type Hosting platform type, possible values GITHUB or BITBUCKET
rebazer.hosts[ ].teams[ ].name Team/company/project name of the repos, first part of the slug
rebazer.hosts[ ].teams[ ].pass Password to access the repositories
rebazer.hosts[ ].teams[ ].repos[ ].name Name/Key of a specific repository

Optional parameter

Parameter Explanation Default Value
rebazer.workspace Workspace Directory for checkouts ./rebazer-workspace
rebazer.garbageCollectionCountdown Number of rebases before a git GC is triggered 20
rebazer.pollInterval Delay in seconds between checks for changes on configured repos 60
rebazer.hosts[ ].url Base URL to the hosting platform api Depents on ..hosts[ ].type, e.g. https://api.github.com
rebazer.hosts[ ].teams[ ].user User for the specific team to access repositories Same as ..teams[ ].name
rebazer.hosts[ ].teams[ ].repos[ ].masterBranch Branch to reset git repo on cleanup after rebase master

Deployment

Spring Application JAR

This JAR can basically be run everywhere a JVM is present; there are no further dependencies. However, for a successful start, several parameters need to be configured (see configuration section for details). There are quite a number of ways to specify these parameters.

If e.g. all parameters are specified in a file called application.yml, the following command should be sufficient for starting rebazer:

java -jar rebazer-VERSION.jar --spring.config.location=file:./application.yml

Docker

There exist a docker image on docker hub. An example configuration for the docker container is placed in the docker-compose.yml.

To configure the rebazer mount the configuration file at /application.yml. To optimize production setups it is recommended to mount /rebazer-workspace as a external storage or ram disk.

Debian package

Attention: We don't ship a fully functional configuration for this package. So after installation, one must ensure that a proper configuration is placed in /etc/rebazer. Also make sure that the configuration file is accessible by the user rebazer.

This package automatically creates:

  • System user for running rebazer
  • Proper logging via systemd/syslog (to /var/log/rebazer)
  • Systemd service named rebazer.service
  • Workspace in /var/lib/rebazer (can be configured in /etc/defaults/rebazer)

The debian package overwrites the rebazer.workspace parameter via an environment variable.

Troubleshooting

Symptom: Errors during startup

Solution: Please make sure the folder /etc/rebazer contains a valid configuration and the user rebazer has access to it.

chmod 755 /etc/rebazer
chmod 600 /etc/rebazer/application.yml
chown rebazer:rebazer /etc/rebazer/application.yml

Build

Build prerequisites

Before building the rebazer application, please make sure that the following tools are installed:

  • Java 8
  • Maven (3.3+)
  • Git

A typical build involves calling the package target via maven from the root of the cloned repository:

mvn clean package

The major artifacts are then build inside the target directory: rebazer-$VERSION.jar.

There are maven profiles to build docker or deb packages.

mvn clean package -P deb

mvn clean package -P docker

mvn clean package -P deb,docker

rebazer's Projects

rebazer icon rebazer

Helper service to handle pull requests on GitHub and Bitbucket.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.