BitBucket Release event
The event can merge one or multiple pull-requests into main branch of the repository, to which that pull-request related.
This is event for sharovik/devbot automation bot.
You can use this event for release optimisation of your project/projects. In the message should be specified 1 or multiple pull-requests. If the PRs are good to go, then bot will try to merge all of them into the main branch of selected repositories.
The event accepts multiple pull-requests for multiple repositories.
If there is more than one pull-request per repository, then bot will create a release pull-request, which should be approved by one of required reviewers, also will send this pull-request link to the channel, where it was triggered.
Table of contents
How it works
You send the message to the PM of bot with the next text:
release
https://bitbucket.org/{your-workspace}/{your-first-repository}/pull-requests/1/readmemd-edited-online-with-bitbucket/diff
https://bitbucket.org/{your-workspace}/{your-second-repository}/pull-requests/20
https://bitbucket.org/{your-workspace}/{your-second-repository}/pull-requests/36/release-pull-request/diff
https://bitbucket.org/{your-workspace}/{your-first-repository}/pull-requests/35/release-pull-request/diff
The bot tries to parse all pull-requests from your message and does several pull-requests checks:
- check the current state of the pull-request. If it's state is different then OPEN, the pull-request cannot be merged
- check if all the reviewers approved the pull-request
- tries to merge the pull-request into the destination
- if there is more than one pull-request, it will create the release pull-request and merge selected pull-request into new release branch destination
You can always ask bot release --help
or bb release --help
to see the usage of that command.
Prerequisites
Before you will start use this event, please be aware of these steps
Clone into devbot project
git clone git@github.com:sharovik/bitbucket-release-event.git events/bitbucketrelease
Install it into your devbot project
- clone this repository into
events/
folder of your devbot project. Please make sure to use bitbucketrelease
folder name for this event
- add into imports path to this event in
defined-events.go
file
import "github.com/sharovik/devbot/events/bitbucketrelease"
- add this event into
defined-events.go
file to the defined events map object
// DefinedEvents variable contains the list of events, which will be installed/used by the devbot
var DefinedEvents = []event.DefinedEventInterface{
//...
bitbucketrelease.Event,
}
Prepare environment variables in your .env
Copy and paste everything from the #Bitbucket section in .env.example
file into .env
file
Create BitBucket client
Here you can find how to do it.
The UseCase diagram
Here you can see the main flow how this event works
The pull-request checks
In this diagram you can see how the current pull-request check works
The release process
In this diagram you can see the flow of the release