Evolved Branch Management with AoneFlow

Automation and new branch management processes are revolutionizing software development

TrunkBased and GitFlow are capable of meeting the branch management needs of most developers in terms of easy integration and manageable requirements features, but Alibaba needed a more efficient system without cumbersome manual operations and with improved branch management tools. This prompted the Alibaba tech team to develop their new branch management mode AoneFlow. AoneFlow incorporates the best of both TrunkBased and GitFlow while introducing new automation and branch management tools to ensure the timely release of high-quality software products.

Branch management foundations: TrunkBased and GitFlow

TrunkBased

TrunkBased has lost popularity to GitFlow in recent years due to several drawbacks. First, an excessive number of teams coding on the same trunk can cause errors at the time of release, particularly during multi-version parallel development. FeatureToggle was implemented as a remedy, but its requirements for frequent integration and adequate test coverage place excessive demands on the capabilities of development teams. As a result, TrunkBased is most often used for SaaS projects where maintaining multiple simultaneous historical versions is not required. These projects are predominately small services that have undergone microservices transformation.

TrunkBased mode has two evolutions: OneFlow and Multi-Trunk. OneFlow uses many of the same functions as TrunkBased, but it defines operating flow more strictly and has added functions like Hotfix branches. Multi-Trunk uses a fixed release branch, in addition to dual trunks and a fixed development branch.

GitFlow

A lesser known branch management method is GithubFlow, which is essentially TrunkBased with added personal warehouses and Pull Request code merging operations. This process is similar to adding individual branches to the same warehouse, making it ideal for distributed teams. GithubFlow also has its own evolutions, including GitlabFlow, which utilizes multi-environment deployments and associates warehouses and branches within its environment.

A new evolution: AoneFlow

Like its predecessors, AoneFlow strives to achieve simple continuous integration (TrunkBased) and manageable requirements features (GitFlow). It also maintains a similar basic structure of three branch types: trunk branches, feature branches, and release branches.

However, AoneFlow departs from its predecessors by establishing three core rules for branch management work flow:

  1. Create a feature branch from the trunk before beginning work.
  2. Form release branches by combining feature branches.
  3. After releasing to the online formal environment, merge the corresponding release branch to the trunk, add tags to the trunk, and delete the feature branches associated with the release branch.

Rule 1: Feature branch creation

Feature branch creation

Rule 2: Release branch formation

In terms of existing branch management methods, GitFlow merges completed feature branches back to the common mainline (development branch) and pulls a release branch from the common mainline. TrunkBased similarly waits for required features to be developed on the trunk branch and then pulls a release branch from a specific location on the trunk branch.

In contrast, AoneFlow pulls a new branch from the trunk and creates a release branch by merging all the feature branches that are waiting to be released or integrated (usually indicated by the prefix “release/”).

This is simple, yet versatile in its applications. Release branches are flexible-use, and they are associated with a specific environment (e.g. the release/test branch is paired with the deployment test environment) using an assembly line tool. This tool connects code quality scans and automated test levels in a series of varied environments. Finally, the output deployment package is released directly into the appropriate environment.

Release branch formation

On a more advanced level, release branches can be associated with multiple environments for tasks like chaining the phased release and formal release. This adds extra human inspection steps to ensure reliability. A continuous integration assembly line can also be created by associating the feature branches according to an iterative plan, creating a fixed release branch through iterative evolutions, and stringing a series of environments to the release branch’s assembly line. TrunkBased effects can also be implemented by associating all feature branches together and dedicating them to integration testing on all commits.

In addition, the composition of release branch features is dynamic and easily adjustable.

For example, smaller companies using “agile operations” must sometimes abandon a function release due to a change in market strategy or eliminate a feature at the last minute due to errors. Normally, this requires manually “ticking the code,” or eliminating the related commitments that were merged into the development or trunk branches one-by-one. Manual “ticking” can be cumbersome and inefficient.

In contrast, AoneFlow allows a release branch to be built in less than a minute. This is done by deleting the original release branch, pulling a new release branch of the same name from the trunk branch, then merging any feature branches that need to be retained. This series of actions can be automated, and they are clean and pollution-free, in that no code ticking records are left behind in the warehouse.

Finally, release branches are loosely-coupled, which allows multiple integration environments to be integrated and tested based on different feature combinations. This is also convenient for managing the deployment timing of features in different environments. Despite being loosely coupled, there is still a correlation between release branches. The release steps of the test, integration, pre-release, phased, and online formal environments are usually performed sequentially. This means the user can set requirements so only characteristics that pass verification in their previous environment can be transmitted to the next environment for deployment. A funnel-shaped feature release stream is created as a result.

In addition, Alibaba has created a unified platform for automating and migrating feature combinations between release branches, which is explained in the next section.

Rule 3: Release branch online deployment

With AoneFlow, the latest version on the trunk branch is always the same as the online version (similar to GitFlow). If the user wishes to trace back a historical version, they only need to find the corresponding version label on the trunk branch.

Structure: Rule 3

Additional Rules

AoneFlow allows the user to find the location of the version label on the trunk branch and then create a Hotfix branch at the same location directly. This allows the user to effectively perform several important operations:

  • Clearing the feature branches of a release branch based on its corresponding online formal environment.
  • Directly modifying the release branch.
  • Using the existing assembly line for automatic release.

User Experience Optimization

Standardization has also helped resolve task-based issues like rebuilding release branches. Rebuilding a release branch requires a merger and then code must be compiled to generate a new deployment package. However, the software can perform inconsistently if its functions depend on third-party software packages.

As a solution, we added a rule to our coding guidelines that states the code for online releases cannot use dependent packages containing “SNAPSHOT versions,” or unofficial releases. This guideline allows our teams to have more control over the quality of the products they produce.

We have also added numerous tools to make our developers’ work easier. For example, the AoneFlow platform eliminates the need for developers to manually create, merge and modify branches using a Git command. Manual operations are prone to errors and time consuming. The AoneFlow platform negates these issues by controlling the entire R&D process and adding numerous built-in service components to enhance R&D efficiency. This platform provides several significant benefits:

  • Full process automation
  • Improved release branch assembly
  • Improved branch-related management

Full process automation

On the front-end, AoneFlow ensures normalized feature branch naming by controlling feature branch association and monitoring requirements. On the back-end, it handles release branch association and deployment, which ensures the reliability of source versions. Overall, AoneFlow handles around 80% of the Alibaba Group’s online deployments.

Improved release branch assembly lines

AoneFlow uses an automated CI/CD assembly line to create and update branches of code. This assembly line links all the independent branches of code in the lifecycle to orient them more efficiently towards their intended functions (e.g. commit code for integration testing). This is especially true for release branches, which can be associated with a specific deployment environment. New code that is merged into a branch can be checked and deployed more efficiently.

In ideal branch management scenarios, each branch should be paired with an assembly line that matches its role. AoneFlow’s release branches are relatively fixed and easier to integrate than GitFlow’s, meaning that nearly every available assembly line tool is compatible with AoneFlow.

AoneFlow also includes additional functions such as code review, security checks and online assembly line deployment that enhance the user experience and optimization for our development teams.

Improved branch association maintenance

Remembering the specific feature branch a release branch comes from is important when making changes to existing feature combinations. For example, when a feature is exited from a specific release branch, multiple feature branches — including branches that didn’t contain the feature — are merged to replace the original release branch. Manually recording which branches are merged is difficult and time-consuming.

AoneFlow includes several automated features that improve this process. When certain feature combinations are verified in low-level release environments (e.g. integrated testing), we migrate the content directly to the corresponding release branch of a high-level environment (e.g. pre-release). This ensures that that the online version has passed pre-release verification, the pre-release version has passed integration verification, and other essential processes. This connects all release branches together in a series. This process can be completed using ordinary Git commands, but AoneFlow’s visual tools make the process more intuitive.

AoneFlow also provides a unified display of branch status in the code warehouse, including the machine information and operations records for the branch’s corresponding deployment environment.

Summary

Benefits of this new branch management method include:

  • Easy integration modeled after TrunkBased
  • Easy-to-manage requirements features modeled after GitFlow
  • Defined rules and processes for ensuring efficiency and quality
  • Automated functionality
  • Improved release branch management
  • Improved branch association maintenance

AoneFlow gives software developers more control over their product by providing a flexible platform that allows them to adapt to dynamic branch management lifecycles, work efficiently, and release quality software products.

. . .

Alibaba Tech
First hand, detailed, and in-depth information about Alibaba’s latest technology → Search “Alibaba Tech” on Facebook

Reference

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store