How Ceph Ansible Leverages Mergify
Mergify has been running for a few months now, and we thought it’d be cool to publish some discussion with our users. Reading about how developers leverage Mergify might be interesting for others and give good ideas to improve your workflow.
Today, we’ll be talking with Sébastien Han, maintainer of the Ceph Ansible project.
Julien: Hi Sébastien! Can you describe what Ceph Ansible is in a few words?
Sébastien: Ceph Ansible is a collection of Ansible playbooks that allows deploying deploy Ceph, a unified distributed storage solution. We’re a small team working almost full time on this project, which includes working on everything, from writing and reviews patches to maintaining the CI.
Julien: Since when do you use Mergify on Ceph Ansible?
Sébastien: We started to use Mergify in June 2018, which I think make us early adopters. We switched to the new engine as soon as it was available in October 2018.
Julien: How do you use Mergify?
Sébastien: The first feature we enabled is the auto-merge feature. We have a CI that can run for a couple of hours, so having to track whenever the CI has finished over to click the merge button was unbearable.
We also enabled the strict mode that Mergify provides, to make sure all our pull requests are updated with the master branch before being merged. That avoid broken pull requests to be merged accidentally.
Lastly, we ship stable branches of our Ansible playbooks. That makes sure users can continue using old branches we released without being forced to upgrade to a newer version right away. We use the backport feature of Mergify for this.
Julien: What are the benefits you get from having Mergify in your workflow?
Sébastien: It saved us a ton of time.
First, we’re not wasting time anymore checking if pull requests are mergeable. When your CI takes a few hours to run, coming back to see if it’s green once in a while to be sure you can click the merge button is a real burden. Now, we don’t have to do that anymore: we just approve the code, and when the CI’s done and pass, it gets merged.
As I mentioned earlier, we use the strict merge mode that Mergify provides. What it does is that it merges each pull request that is mergeable sequentially while making sure that each pull request is up-to-date for its target branch. Mergify’s documentation has a good explanation on why you want to use this to avoid merging broken code.
We spent a lot of times backporting bug fixes to stable branches. When you maintain three stables branches as we do currently, that means you have to create three new pull requests to backport a fix that has been merged to master. Then you had to wait for the CI to pass, and then you’d click the merge button.
To scale, we had to beg our contributors to do the backport themselves most of the time — that ok-ish for regular committers, but it’s not very pleasant for one-time contributors.
Now, we’ve fully automatized that backport process with Mergify. We set a label on the pull request we want Mergify to backport, and then Mergify creates the pull requests for us and automatically merge the backported pull request once the CI validates it. No need for manual intervention anymore — except if, e.g., a conflict arises or the CI does not pass, then we’ll fix it ourselves.
There’s no need to ask anybody to do anything. If we forget to backport something, we can go back to the merged pull request and apply the label a few weeks later — it still works anyway! That also means anyone from the organization can now help us backporting by just adding a label to a pull request.
Julien: Maybe I shouldn’t ask :-) but what would be the future functionalities that you’d love having?
Sébastien: Frankly, we’re delighted with what we got so far! The only thing we miss is the ability to have a different update mode for pull requests when using the strict method and to be able to trigger a rebase of the pull request.
That last one would be especially handy in the case where your master branch is broken, and therefore all the pull requests fail the CI. You’ll push a fix to master, but then you need to manually rebase all your pull requests to get that fix — which is very tedious. We’d love to have Mergify help us here!
Julien: Thanks a lot for your time Sébastien!
Sébastien: You’re welcome, and thanks for helping us saving time. :-)
If you’re curious about the rules that Ceph Ansible’s using, you can dig into their .mergify.yml.
If you’re a Mergify user and would love to share your experience too, feel free to contact us!