Business Central internals are backed by a GIT Java NIO2 implementation. On 7+ series, one of our major goals is to provide an awesome GIT flow experience to our users.
Going to this direction, I’ve just pushed multiple branches support for Business Central (web tooling for Drools, OptaPlanner and jBPM projects), that allows users to work on multiple source branches interchangeably. This post gives a quick preview of this feature and also provides some internal details for those interested in some internals of the solution.
This is part of series of posts that covers announcements and discussions of new features released on Business Central (web tooling for Drools, Optaplanner and jBPM projects) by the awesome Foundation Team members.
After you have created and opened a project, you can see all the assets of your project.
In the breadcrumbs navigation, you can now see a dropdown that, when clicked, shows all the branches available.
There is also an “Add Branch” action, so you can add more branches to your project. When clicked, you should see a popup like this:
After adding the new branch, you will be redirected to it, and it will have all the assets that you had in the base branch.
It’s also possible to delete a branch (except for the master branch). There is a “Delete branch” option in the top-right corner kebab.
With this new feature for business central, we allow users to work on multiple source branches interchangeably, improving the GIT flow of their projects.
Architecture and Implementation
Let’s dive at some details of this implementation. First, let’s take a quick recap of how our NIO2 Path implementation works.
Internally, we work with different branches using the following path structure:
The path above represents the root directory of a project in a given branch. A file inside this project could be represented by the following path:
In order to be scalable and cloud-ready, when a user accesses the asset list from a project, we don’t query directly the filesystem, but instead, every asset list that you see on business central comes from our index engine.
Before we supported multiple branches, we used to group assets indexes by each project of a space. In order to support multiple branches, we had to change the way that this grouping works. Basically, now we have one index for each branch of a project of a space.
External Updates via SSH
Business central provide access to the git repository via SSH. If you clone a repository with e.g. “git clone ssh://127.0.0.1:8001/kiegroup/Mortgages” and push some changes, internally we analyze every commit content in order to trigger the respective file system Watch Service events in order to update our indexes and the internal state.
But how to deal with a new branch created? How to trigger a “branch list refresh” when the user created a new branch via SSH?
In order to achieve this, we created a new “hook” mechanism for our NIO filesystem implementation. Basically, now you can add hooks to some operations when creating a file system, and every time that this operation happens, the filesystem call those hooks. For instance, we now have a hook for external updates on business central filesystems:
This new hook engine will be probably used to also trigger external events (i.e. calling a webhook) on future git flow development.
Gradually, we are moving towards an awesome git flow on Business Central, and branch support is one step ahead in this direction. The next step in this area we’ll focus on better external repository integration (i.e. with Github and GitLab). Stay tuned.
Branch support on Business Central was originally published in kie-tooling on Medium, where people are continuing the conversation by highlighting and responding to this story.