Hello,
I am looking for test/build/deploy setup via Bitbucket pipelines. As pipeline is started when code was pushed/merged to a desirable branch, like master, I have to be sure that my pull request or commit will not brake pipeline otherwise I have to roll it back (as broken code was merged).
Bitbucket premium has Required merge checks feature which includes Require all tasks to be completed (https://blog.bitbucket.org/2016/12/05/protect-your-master-branch-with-merge-checks/) but what does it mean? Is it something custom or it's already defined by Bitbucket?
Also, is it possible to get a free trial for a week or so in order to try it out? Because my team will definitely consider premium if it helps to block PR merge by my custom checks.
Thanks for any help.
Hi @Philip Hodder
Thank you for your answer. By custom merge checks I meant something is defined by my own, like write some script. For instance, if I want to be sure that my feature branch includes all commits from master right before merge, those merge checks would not help me, but `git diff` command in some script definitely will.
Merge checks idea is really great, but it's really sad that I can not add my own merge checks.
Thanks,
Mykhailo
Hi Mykhailo,
If you'd like to create a custom script, you could add it as a part of your branch defined Pipelines. For example:
pipelines:
branches:
feature/*:
step:
script:
- ./build-and-test
- ./lint-all-code # i.e. If code is poorly formatted, then fail the build.
- ./verify-master-is-up-to-date
master:
step:
script:
- ./build-test-and-deploy
Then your PR would be blocked by the "Require all builds to be green"
It doesn't work perfectly for your specific use-case of checking master just before merge. But the above pattern is how we've been approaching general checks internally.
Alternatively, have a look at changing your merge strategy to "Fast forward": https://confluence.atlassian.com/bitbucket/merge-a-pull-request-945541513.html#Mergeapullrequest-Mergestrategies
I'm not familiar with the implementation of this. In particular, I'm unsure if it'll enforce you to be up to date with master first. So you'll need to play around with this. It seems like it might satisfy the specific use-case you have.
I've also added some relevant links below:
We have an open ticket for PR triggered pipelines here: https://bitbucket.org/site/master/issues/13438/add-specific-pipelines-configuration-for
If you'd like to open a feature request for more general merge check rules, you can do so here: https://bitbucket.org/site/master/issues/new
Thanks,
Phil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mykhailo,
The merge checks feature is customisable. Here's an example, where I've restricted writing to master only via PR, where only I can merge the PR, and when it has satisfied the other criteria:
I'm unaware of any free trials for Premium. But you can try out this feature already, on any plan. You won't be able to block PRs from being merged, but you'll get a warning when you try to merge. The premium plan allows you to force that the rules must be satisfied.
You can configure these on the Repository Settings -> Workflow -> Branch Permissions
Thanks,
Phil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.