In a multi-developer environment, it is essential to establish a transparent workflow for verifying code changes and integrating them into the codebase easily, quickly, and effectively. A proven way to manage this process is with merge requests and code reviews. Continuous Integration (CI) tools like Jenkins can also streamline this process.
Merging involves consolidating the work of each developer back into the main branch of the code repository. Source control management tools like Git enable developers to create and merge branches from the main codebase, but the "review" part of the process is typically left to development teams to implement on their own.
The question is: what's the best way to merge the work of multiple individual developers into a single product without introducing errors or confusion?
Code review looks at the code independently from the rest of the program and answers two fundamental questions: Does it build and test correctly? Does it do what it is intended to do?
The first question is often answered by running a build process. If the code fails the build, it should not be merged.
The second phase of code review should be performed by an individual other than the author. All reviewers' comments must be documented and resolved before the code is committed to being merged.
Your repository should enforce the specific rules for code review. Ossum provides this ability.
Merge Requests in Ossum
As noted, merge requests (including code review) can be done in plain old Git. However, native Git does not include a clear process to ensure that merge requests are implemented uniformly across a geographically diverse programmer base. To implement a process for merge requests in Git, you have to build it yourself.
Ossum includes a built-in process for merge requests. The process includes extensive support for CI and code reviews.
To perform code reviews in Git, you have to first publish the code to a central repository. With ossum, you can do code reviews outside of the central repository before changes are merged. The code is not entered into the main repository until it passes the code review process. The built-in process for merge requests and code reviews makes this essential piece of the workflow much simpler to implement.
The figure below provides an example of an ossum space containing the task cards for developers:
In a typical workflow, the developer chooses a card representing a task to accomplish. Let's assume in this case the developer chooses the top-most card from the Ready for Dev column (slack bot), which entails changes to the codebase.
To start working on this task, the developer would select the card and go to the repository containing the slack bot. The developer might check out the code to a new branch and make any required changes or write new code. (Ossum supports both working in the developer's preferred editor or IDE, or coding inline in ossum.)
Once the developer's coding work is complete, the commit process enables them to open a merge request associated with that commit.
The figure below shows an open merge request:
Ossum can be configured to initiate a CI verification process on opening a merge request. The merge request screen displays the results of the verification process. Everyone assigned to the task receives the results of the verification. If the CI verification fails, the merge request shows a failure along with a link to the log files. This process avoids reviewers spending time commenting on code that is still in revision.
Once the code has passed the CI verification, the second stage of code review begins. On the right-hand side of the ossum Merge Requests screen is a list of the people assigned to the review. If there's a CI verification process and it is completed successfully, a thumbs-up icon is displayed to the left of DevOps.
Other reviewers can then begin their code review by going to the File tab on the top of the screen. Selecting this tab brings up a diffs view of the code. In this view, the reviewer can view the code and make inline comments. The reviewers can also make overall comments or respond to other reviewers’ comments on the main page in rich text format. Ossum maintains a lasting record of all of the comments and responses.
After resolving the issues, the reviewers can provide a thumbs up indicating the code is ready to merge into the main code database.
The Ossum team is currently working on enhancements to the code review process. These enhancements will include the ability for the team to set requirements for who must approve and how many approvals are necessary. It will also contain the ability to set up approval groups.
Ossum supports all of these merge best practices. For more information or to try Ossum, sign up at ossum.cloud.