/bitbutler

A bitbucket administration script

Primary LanguageShellMIT LicenseMIT

bitbutler

CircleCI Test Coverage made-with-bash

A bitbucket administration utility.

Runtime requirements

  • bash
  • curl
  • jq

Installation

sudo make install

By default, the makefile installs to /usr/local prefix. This can be overridden with the usual variables PREFIX and DESTDIR. For example, to install to ~/.local, run make PREFIX=$HOME/.local.

Bash completion

For bash completion, source the included bitbutler.completion file anywhere in bash, for example in your .bashrc:

# append to .bashrc
. path/to/bitbutler.completion

NOTE: The bash completion script needs the bitbutler executable within the PATH.

Usage

There is a short overview of available commands built-in and accessible via bitbutler help. For a more extensive documentation, consult the included manpage.

Configuration

Run bitbutler config to write a default configuration. You should create a restricted app password instead of using your actual password which has full access to your account. Depending on what you want to do with bitbutler, different scopes are required, see table below.

Bitbutler command required scope Name the bitbucket GUI
authtest account Account / Read (implies Email)
branches repository Repositories / Read
deploykey add repository Repositories / Read
repository:admin Repositories / Admin
deploykey delete repository Repositories / Read
repository:admin Repositories / Admin
deploykey list repository Repositories / Read
repository:admin Repositories / Admin
project add project:write Projects / Write
project delete project:write Projects / Write
project list project Projects / Read
pullrequest approve pullrequest:write Pullrequest / Write
pullrequest list pullrequest Pullrequest / Read
pullrequest unapprove pullrequest:write Pullrequest / Write
repo add repository:admin Repositories / Admin
repo delete repository:delete Repositories / Delete
repo list repository Repositories / Read
restriction add repository:admin Repositories / Admin
restriction delete repository:admin Repositories / Admin
restriction list repository:admin Repositories / Admin
reviewer add repository:admin Repositories / Admin
reviewer delete repository:admin Repositories / Admin
reviewer list pullrequest Pull requests / Read
webhook add webhook Webhooks / Read and write
webhook delete webhook Webhooks / Read and write
webhook list webhook Webhooks / Read and write

Development

Requirements

Running tests

make test

Or, with coverage:

make coverage

Check code style

make stylecheck