Matoffo Logo

Trunk-Based Branching Strategy & CI/CD Improvements

Executive Summary

Fulfilling multiple socially-oriented missions, our client is a powerful player in the African market. The organization provides various companies, ranging from startups to small businesses, with mentorship, training, and access to funding opportunities, therefore driving economic growth and development across the continent. In this regard, the client’s complex services required an efficient trunk-based branching strategy & CI/CD improvements. Diving deeply into the client’s core requirements and pain points, the Matoffo team designed a powerful cloud solution that perfectly meets their unique needs.

About the Customer

Our client is an innovative enterprise based in Nairobi, Kenya. Their primary mission is to empower both businesses and individuals by harnessing cutting-edge technologies and connecting customers and suppliers to ensure better prices and quality. This unique organization is alleviating the financial burden on African consumers. Since they introduced a groundbreaking B2C eCommerce model explicitly tailored for the urban majority across the African continent, their ultimate vision lies in providing users with the guidance and support needed to help local residents make significant savings on their grocery baskets. By leveraging technology to stimulate economic growth, this company is dedicated to building a more prosperous and equitable future for African society.

Customer Challenge

In a nutshell, there are several challenges the client could face when it comes to the develop branch. Let us take a closer look at each of them. The first one is friction associated with the develop branch. The develop branch serves two conflicting use cases:

1. It grants access to the development environment.
2. It is the base from which developers create release/* branches for deployment to production and later to staging.

This leads to a continual tug-of-war between engineers trying to test features in dev, and engineers preparing the next release for production. It also creates an ongoing risk that untested or buggy features will be accidentally deployed to production.

The second issue is friction associated with AWS environments. Testing and releasing features is often blocked by another (potentially buggy) feature in the staging or development environment.

The following potential threat represents risky deployments. The branching strategy involves comparatively many branches with complicated rules. This has been a causal factor in past incidents.

Additionally, due to the time spent waiting or being blocked in some parts of the development cycle, deployments are often large and include lots of unrelated changes. This makes them harder to review, troubleshoot, and roll back.

Finally, it is essential to mention the slower deployment issues.
In the words of the original author of the git-flow branching model, web apps are typically continuously delivered, not rolled back, and developers do not have to support multiple versions of the software running in the wild.

Why AWS

Speaking of a trunk-based Git model, also known as a “mainline” or “single branch” development model, it has several benefits that can make it a perfect choice for specific software development teams and projects.

First and foremost, a trunk-based Git model offers next-gen simplicity. This type of development significantly simplifies the branching and merging strategy compared to more complex branching models like Gitflow or feature branching. There is typically only one long-lived branch (the trunk or mainline), making it easier to manage and understand.

The second remarkable advantage of this model is reduced merge complexity. With fewer long-lived branches, there are fewer opportunities for complex merge conflicts to arise. This can reduce the time and effort spent on resolving merge issues, making development more efficient.

Thirdly, faster feedback also plays a crucial role in a trunk-based Git model. Changes are integrated into the mainline quickly, so testing and validation happen continuously. This allows for faster feedback on the quality of code changes, helping to catch and fix issues earlier in the development process.

When it comes to a trunk-based Git model, improved collaboration is another essential benefit you should pay attention to. This model encourages collaboration among team members since everyone is working on the same branch. As a result, it ensures enhanced communication and knowledge-sharing practices among team members.

Last but not least, a trunk-based Git model is associated with a simplified release process. Releases are typically more straightforward in a trunk-based model because the mainline branch always represents the latest stable version of the software. Hence, managing multiple long-lived release branches or hotfix branches is unnecessary.

However, it is essential to note that the above-listed benefits are not suitable for all types of projects and teams. By way of illustration, projects with strict release schedules, complex features, or large development teams typically require more complex branching models.

Why Matoffo

While each organization has unique cloud development requirements, it is essential to look for a partner that offers a client-focused approach.

Fortunately, the Matoffo team works closely with each client to build and customize trunk-based branching strategy & CI/CD solutions that meet and exceed clients’ expectations.

Bearing all the potential threats and opportunities in mind, we always come up with a tailor-made solution that satisfies the client’s requirements in terms of price, functionality, and timeline. Subsequently, this is why businesses partner with cloud development providers like Matoffo.

Since we offer a range of benefits, including increased flexibility, cost savings, access to expertise, and enhanced security, the development process turns into an enjoyable journey with our team.

Matoffo Solution

Implementing a trunk-based development model in GitLab, along with GitLab CI/CD pipelines, involves configuring your repository and CI/CD configuration to support this workflow. Below are the steps we conducted for setting up a trunk-based model in GitLab:

1. Repository Setup
Our team designated a main branch (e.g., `main` or `master`) representing the main development line. All new features and bug fixes were based on this branch. Next, we protected the main branch to prevent direct pushes or force pushes. This crucial step is essential to maintaining the stability of the main branch.

2. Feature Development
We created short-lived feature branches from the main branch for their work. Besides, we rebased feature branches onto the latest changes in the main branch to keep code up-to-date and minimize merge conflicts.

3. CI/CD Pipeline Configuration
As we moved into the next development stage, it was necessary to set up GitLab CI/CD configuration in the repository’s `.gitlab-ci.yml` file to define pipeline stages and jobs while ensuring CI/CD pipeline covers building, testing, and deployment. At the same time, our team configured pipeline triggers so that whenever changes are pushed to the main branch, the CI/CD pipeline automatically runs. These steps ensure continuous integration on the mainline.

4. Merge Process
Finally, we conducted code reviews for all feature branches before merging into the main branch. Besides, our skilled team created merge requests (MRs) to propose changes to the main branch and set up pipeline status checks for MRs. We also encouraged fast-forward merges for MRs to keep the commit history linear and avoid unnecessary merge commits.

By following these steps and configuring our GitLab repository and CI/CD pipeline accordingly, our team successfully implemented a trunk-based development model in GitLab. To complete this solution, we utilized the following tech stack: Gitlab, Gitlab Pipelines, and AWS EKS.

Schematic Description

Generative AI Logo

Business Value

Thanks to implementing a trunk-based development approach in GitLab, our client gained access to a wide array of benefits.
By accelerating development cycles, reducing costs, enhancing code quality, and improving collaboration, this solution boosts customer satisfaction and competitiveness.

What is more, this exceptional model promotes collaboration, faster development cycles, and improved code quality while maintaining a stable main branch.

Customer Feedback

What is the best motivation for a cloud development provider like Matoffo? There is no doubt that it is positive feedback from our valuable clients. Luckily, this solution provided our client with increased efficiency and a first-class technology foundation, while we gained one more positive review that inspired our team to reach new heights. All in all, we would be thrilled to continue our fruitful partnership with the client.

vector cloud icon

OUR FOCUS IS
CLOUD SOLUTIONS

Our primary goal is to deliver value to our clients by resolving technical challenges and helping them achieve their objectives. We utilize cloud solutions as a powerful toolset to make this happen. With Matoffo expertise, companies can significantly reduce the time from idea to market and rapidly scale their digital business. Additionally, Matoffo enables seamless adoption of rapidly growing tech capabilities, transforming businesses to stay competitive in the market.

Tell us about your business needs

We will add your contact information included in this form to our CRM in order to process your requests efficiently. For any inquiries, look through our Privacy Policy.