Who we are

We are the developers of Plastic SCM, a full version control stack (not a Git variant). We work on the strongest branching and merging you can find, and a core that doesn't cringe with huge binaries and repos. We also develop the GUIs, mergetools and everything needed to give you the full version control stack.

If you want to give it a try, download it from here.

We also code SemanticMerge, and the gmaster Git client.

Configuring trunk-bot to use embedded Plastic code reviews

Tuesday, September 17, 2019 María Barrios Carrasco , , 0 Comments

UPDATE June 15, 2020: We edited the blog post to use the new code review statuses (Under Review instead of pending, Reviewed instead of approved, and Rework Required instead of discarded).

Trunk-bot, one of the included mergebots, now takes into account code reviews and is able to merge reviewed branches only.

We are improving our built-in code review system, and we want to make it as easy as possible for you to take advantage of it. That's why we created Merge Rules, and why we have now enhanced the mergebots.

For those of you unfamiliar with mergebots, a mergebot is a piece of software that runs on your Plastic server and tries to merge task branches once they have met given criteria. Previously, mergebots only checked whether a branch had a given attribute, or if the associated Jira had a given status on it. Now we have added the branch review status into the mix, so you can easily incorporate code reviews into your CI/CD process.

Let's see how to configure this new setup.

Configuring trunk-bot to use code reviews

  1. Open the DevOps section in your Plastic SCM WebAdmin.
  2. Enable the Process reviewed branches only toggle button in trunk-bot configuration to activate this feature:

How does this feature work?

  1. When you create a code review for a tracked branch, or the existing code review status is changed, the task branch enters the trunk-bot queue. (You configure which branches are tracked using a prefix in the trunk-bot configuration).
  2. When trunk-bot dequeues this task branch, trunk-bot verifies that there is a code review for the branch, and that it's status is Reviewed, before continuing the CI cycle. If not, the branch processing is skipped and the branch is requeued.
  3. If there is more than one code review linked to this task branch, all of them need to be Reviewed for the task branch to be processed.
  4. If all the code reviews are Reviewed, trunk-bot will continue processing:
    • If the merge fails (manual conflicts are detected), or the branch build in the configured CI system fails, the status of the linked code reviews of the branch will be set to Under Review.
    • If the merge succeeds and the branch build succeeds too, the task branch is merged, and the "status" attribute of the branch is set to "merged" (these fields must be specified in the trunk-bot configuration).

You can use this Process reviewed branches only policy alone to drive the CI/CD cycle, or use the legacy "branch status" based lifecycle (Branch lifecycle configuration with a status attribute) to drive the process, or combine them.

If you combine them, before task branch is merged into trunk, both the status of the branch must be set to "resolved", and all the code reviews must be set to Reviewed.

María Barrios Carrasco
I'm in charge of the documentation area and the one to let you know the news about our products: Plastic SCM, SemanticMerge and gmaster.
I started my degree in Computer Engineering at the University of Burgos and finished my studies at the University of Valladolid.
I love doing handmade crafts, going for a walk and for tapas 😋.
You can reach me at @maria13mbc.

0 comentarios: