[Java] AoneFlow introduces new automation and branch management tools

11 minute read

AoneFlow incorporates the strengths of both Trunk Based and ** Git Flow ** while introducing new automation and branch management tools for timely release of quality software products.

*This blog is a translation from the English version. You can check the original from here. We use some machine translation. If you find any mistakes in the translation, we would appreciate it if you could point it out. *

** Automation and new branch management processes are revolutionizing software development. ** ** image.png

While TrunkBased and GitFlow can meet the branch management needs of most developers in terms of easy integration and manageable requirements features, Alibaba is more efficient without the hassle of manual intervention. I needed a system and improved branch management tools. In response, Alibaba’s technical team has developed a new branch management mode, AoneFlow. AoneFlow incorporates the strengths of both TrunkBased and GitFlow, while introducing new automation and branch management tools to ensure timely release of quality software products.

Branch management foundation: TrunkBased and GitFlow

AoneFlow is partly based on the structure and functionality of TrunkBased and GitFlow, the most commonly used branch management techniques for software developers. Both systems provide useful features, and based on existing systems, AoneFlow has the advantage of being familiar to software developers.

TrunkBased

The advantage of TrunkBased is continuous integration. The structure consists of a single trunk branch and many release branches. Each release branch is created from the trunk with a specific version commit point for online deployment and hotfixes. There is no explicit feature branch. GitFlow allows each developer to have a local branch, whereas TrunkBased does not rule out short-lived functional branches. However, this feature is not widely used by TrunkBased developers.

TrunkBased has recently become less popular with GitFlow because of some drawbacks. First, if you have too many teams coding in the same trunk, you may get an error during release. FeatureToggle was implemented as a solution, but it requires too much integration and good test coverage, which overwhelms the capabilities of the development team. As a result, TrunkBased is mostly used in SaaS projects that do not need to manage multiple past versions simultaneously. These projects are small services that have undergone a major transformation of microservices.

There are two evolutions in Trunk Based mode. OneFlow and Multi-Trunk. OneFlow uses many of the same features as TrunkBased, but with a more rigorous definition of the operational flow and features like Hotfix branches. Multi-Trunk uses fixed release branches in addition to dual trunks and fixed development branches.

GitFlow

GitFlow has a different structure than TrunkBased. It consists of a trunk branch and numerous feature, release, and hotfix branches. GitFlow was previously most used by process-oriented companies due to its clear operational definition at each stage. However, GitFlow is not user friendly and contains a lot of cumbersome merge rules. Merge conflicts and integration testing issues are often criticized.

A lesser-known branch management method is GithubFlow, which is basically TrunkBased with the addition of a merge operation for private warehouses and pull request code. This process is similar to adding individual branches to the same warehouse, making it ideal for distributed teams. GithubFlow also has its own evolution: GitlabFlow takes advantage of deployments in multiple environments and associates warehouses and branches within those environments.

New evolution: AoneFlow

AoneFlow’s structure, functionality, and process differ from TrunkBased and GitHub in several key areas.

Like its predecessor, AoneFlow aims to provide simple continuous integration (TrunkBased) and manageable requirements functionality (GitFlow). It also maintains the basic structure of the three branch types: trunk branch, feature branch, and release branch.

However, AoneFlow starts with its predecessor by establishing three core rules for a branch management workflow.

1.Before you start, create a functional branch from the trunk.

  1. Combine feature branches to form a release branch.
  2. After releasing to the online formal environment, merge the corresponding release branch into the trunk, add tags to the trunk and remove the feature branch associated with the release branch.

Rule 1. Creating a feature branch

The feature branch of AoneFlow has been adopted from GitFlow. When a new job is started (creating a new function, resolving errors, etc.), the feature branch with the prefix “feature/” is created from the trunk representing the latest release version. Code changes will be committed in this branch. Each job corresponds to one feature branch, and you cannot commit changes directly to the trunk, as shown in the following figure.

image.png Creating a feature branch

Rule 2. Unform branch

This rule is AoneFlow’s most innovative achievement.

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

In contrast, AoneFlow pulls a new branch from the trunk and merges all the feature branches waiting for release or integration to create a release branch (usually denoted by the “release/” prefix). ).

While simple, it has many uses. Release branches are flexible and can be associated with a particular environment using assembly line tools (for example, a release / test branch is paired with a deployment test environment). This tool connects code quality scanning and automated test levels to a diverse set of environments. Finally, the resulting deployment package is released directly to the appropriate environment.

image.png

Release branch formation

At a higher level, release branches can be associated with multiple environments for tasks such as chaining phased releases with official releases. This adds an additional human inspection step to ensure reliability. You can also create a continuous integration assembly line by associating functional branches according to an iterative plan, iterative evolution to create fixed release branches, and a set of environments tied to release branch assembly lines. You can also implement the effects of TrunkBased by associating all functional branches and devoting all your commits to integration testing.

In addition, the configuration of features in the release branch is dynamic and can be easily adjusted.

For example, a small company that employs “Agile operations” may have to abandon a feature release due to changes in market strategy or have a last-minute removal of a feature due to an error. This usually involves manually “checking the code” or removing the associated commitments that have been merged into the development or trunk branches one by one.

In contrast, AoneFlow allows you to build a release branch 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, and merging the feature branches that you need to keep. This series of operations can be automated, clean and free from contamination.

Finally, the loosely coupled release branches allow you to integrate and test multiple integrated environments based on a combination of different features. It is also useful for managing when features are deployed in different environments. Despite being loosely coupled, there is a correlation between release branches. Release steps for test, integration, pre-release, staged, and online formal environments are typically performed sequentially. This means that the user can set requirements, and only those characteristics that have passed validation in the previous environment can be transferred to the next environment for deployment. As a result, a funnel-shaped feature release stream is created.

In addition, Alibaba has created a unified platform for automating and migrating the combination of features between release branches as described in the next section.

Rule 3. Release branch online deployment

When the assembly line on the release branch completes the deployment of the online formal environment, it means that the corresponding feature has been released. In this case the release branch must be merged into the trunk. You should also clean up feature branches that are already online to avoid a large buildup of past feature branches in your code warehouse.

With AoneFlow, the latest version of the trunk branch is always the same as the online version (similar to GitFlow). If the user wants to trace back past versions, they just need to find the corresponding version label on the trunk branch.image.png

Structure: Rule 3

Additional rules

Along with rules 1-3, AoneFlow adds some practical operations. For example, when a hotfix comes online, the normal processing method is to create a new release branch (corresponding to the hotfix branch) corresponding to the online environment. It then creates a temporary assembly line for the release branch so that pre-release inspections and smoke tests can be run automatically.

AoneFlow allows you to find the location of the version label on your trunk branch and create a hotfix branch directly there. This allows the user to effectively perform some important operations.

  • -Clear the feature branch of the release branch based on the corresponding online formal environment.
  • Fix release branch directly.
  • Automatic release using existing assembly line

Optimize user experience

Alibaba consistently seeks to optimize its branch management process. Most recently, we have documented Java development best practices and compiled them into the Alibaba Java Development Manual. This allowed us to standardize Java development across the team and improve the quality and efficiency of our work.

In addition, standardization allowed us to solve task-based issues such as rebuilding the release branch. Rebuilding the release branch requires a merger, and then the code needs to be compiled to generate a new deployment package. However, if the functionality of the software depends on third-party software packages, the behavior of the software may be inconsistent.

As a solution, I added a rule to the coding guidelines that code for online releases should not use dependent packages that contain “SNAPSHOT versions” or unofficial releases. These guidelines give our team more control over the quality of the products they produce.

We’ve also added a number of tools to make it easier for developers. For example, with the AoneFlow platform, developers no longer have to manually use Git commands to create, merge, or modify branches. Manual work is error prone and time consuming. The AoneFlow platform denies these issues by controlling the entire R&D process and adding numerous built-in service components to enhance R&D efficiency. This platform offers several important benefits.

  • Full process automation
  • Improved release branch
  • Enrichment of branch related management

Full process automation

The AoneFlow platform provides proposals for requirements, division of requirements into tasks, online creation of functional branches, generation of release branches by aggregating functional branches, automatic creation of test environments based on templates, late stage operation and maintenance (O&M), etc. Introduces automation of the branch management process for features.

On the front end, AoneFlow guarantees normalization of feature branch names by controlling feature branch association and monitoring requirements. The back end handles the release branch association and deployment, ensuring source version reliability. Overall, AoneFlow handles approximately 80% of Alibaba Group’s online deployments.

Improved release branch assembly line

There are many code branches in the life cycle of AoneFlow. Creating and updating these branches involves complex actions. By automating this process, quality and efficiency are not lost due to human error.

AoneFlow uses automated CI/CD assembly lines to create and update branches of code. This assembly line links all the independent branches of your code in the life cycle and directs them more efficiently towards their intended functionality (eg commit code for integration testing). .. This is especially true for release branches, which can be tied to a particular deployment environment. You can check the new code merged into your branch and deploy it more efficiently.

In an ideal branch management scenario, each branch should be paired with an assembly line that matches its role. The release branch of AoneFlow is relatively fixed and more easily integrated than GitFlow, so almost all available assembly line tools are compatible with AoneFlow.

AoneFlow also includes additional features such as code reviews, security checks, and online assembly line deployment to improve the user experience and optimize your development team.

Improved branch association maintenance

Maintaining the association between the feature branch and the research branch is a unique issue that AoneFlow addresses.

When making changes to an existing feature set, it’s important to remember which feature branch the release branch came from. For example, if a feature is removed from a particular release branch, multiple feature branches will be merged and replaced with the original release branch, including those that don’t contain the feature. It is difficult and time consuming to manually record which branches were merged.

AoneFlow includes some automation features that improve this process. When a particular feature combination is validated in a low-level release environment (such as integration testing), that content is moved directly to the corresponding release branch in the high-level environment (such as pre-release). This ensures that the online version has passed pre-release validation, the pre-release version has passed integrated validation, and other important processes. This will connect all release branches in a series of flows. This process can be completed with a normal Git command, but you can do it more intuitively using AoneFlow’s visual tools.

In addition, AoneFlow can uniformly display the status of branches in the code warehouse, such as machine information and operation records of the deployment environment of the corresponding branch.

Overview

Alibaba’s AoneFlow is an evolution of branch management that leverages the strengths of TrunkBased and GitFlow.

The advantages of this new branch management method are:

  • -Easy integration modeled on Trunk Based
  • Easy-to-manage requirement function modeled after GitFlow
  • Define rules and processes to ensure efficiency and quality
  • Automated functions
  • -Improved release branch management
  • Improved branch association maintenance

AoneFlow provides software developers with a flexible platform that adapts to the dynamic branch management lifecycle, works efficiently, and releases quality software products. Gives you more control over.

Alibaba Tech

Alibaba’s latest technology first hand, details, detailed information → Search “Alibaba Tech” on Facebook.

Alibaba Cloud is a No. 1 cloud infrastructure operator in the Asia Pacific region (2019 Gartner) with two data centers in Japan and more than 60 availability zones in the world. Click here for more information about Alibaba Cloud. Alibaba Cloud Japan Official Page