Giter Site home page Giter Site logo

ankan-devops / bitbucket-cascade-merge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jmswenski/bitbucket-cascade-merge

0.0 0.0 0.0 2 KB

A Bitbucket Cascade Merger Because BCLOUD-14286

License: MIT License

Go 96.51% Makefile 1.30% Dockerfile 2.20%

bitbucket-cascade-merge's Introduction

bitbucket-cascade-merge

This is a web app written in Go that nearly emulates the Bitbucket Server (Formerly Atlassian Stash) feature Automatic Branch Merging. Unfortunately, the cloud version of Bitbucket doesn't have this feature much to the dissatisfaction of the humans commenting on the infamous BCLOUD-14286. It works by using Bitbucket Cloud Webhooks as well as a little bit of semantic versioning a few API calls. It doesn't automatically merge the branches. It instead creates pull request with the original author as the reviewer. At Funraise, we use some premium Bitbucket features to enforce build checks and some additional sign offs so we prefer just the automatic PR. There is an unused function MergePullRequest you could probably play around with in bitbucket.go if you really wanted to get fully automatic merges.

Deploy it somewhere like Heroku and dry those missing feature parity tears.

Environment Variables

Here are the environment variables you'll need to set:

RELEASE_BRANCH_PREFIX - the prefix of the branches you use for your releases. We use release/ at our shop so our release branches look like release/2020.12.0 the app uses this to look up branches to target PRs against as well as for some substitutions in semver.go

DEVELOPMENT_BRANCH_NAME - this should typically be develop. If you're not using develop for your current develop branch, I question your life choices, but it's a free country.

BITBUCKET_USERNAME - Username for bitbucket user that will be doing the API calls and creating the automatic pull requests. It's best if this is a non-human user, i.e. a dedicated bitbucket account for builds or bots.

BITBUCKET_PASSWORD - Password for bitbucket user that will be doing the API calls and creating the automatic pull requests. It's best if this is a non-human user, i.e. a dedicated bitbucket account for builds or bots.

BITBUCKET_SHARED_KEY - A random UUID or long value to act as an "Api Key" to protect our webhook

Setting up the Webhook

Once you have your app deployed, go create a Bitbucket Webhook for your repository. You can configure it to fire on all the triggers under Pull Request at minimum. For the URL, you should input https://your-deployed-app-url.yourhost.com?key?={BITBUCKET_SHARED_KEY}. Replace {BITBUCKET_SHARED_KEY} by whatever you set for the BITBUCKET_SHARED_KEY environment variable.

bitbucket-cascade-merge's People

Contributors

jmswenski avatar

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.