Your CI GitFlow is Broken

One of the great things about GitFlow is that it makes parallel development very easy by isolating new development from finished work. New development, such as features, is done in feature branches and is only merged back into the main body of code when developers have validated the feature and the code is ready for release. For most development teams, feature validation happens in a staging branch coupled with a single testing environment. When this single environment is broken, releases are delayed, developers are stressed, and your team loses the benefits of GitFlow - promoting parallel development. In this article, I will explain why using a single testing environment breaks the GitFlow benefits and introduce a solution to get dynamic testing environments per branch - Preview Environments.

Romaric Philogène

Romaric Philogène

August 28, 2022 · 3 min read
Your CI GitFlow is Broken - Qovery

#GitFlow with a single testing environment: what's wrong?

When developers' teams use GitFlow, 1 branch for staging and 1 branch for production are created and live in parallel. The process is simple, once a feature branch is done, it is merged back into the staging branch - which is associated with a testing environment. All the tests from this environment must be green to proceed and merge the staging into the production branch - which will lead to releasing the feature. A picture is worth a thousand words; here is what a traditional GitFlow looks like

Traditional Release GitFlow
Traditional Release GitFlow

But here are the main issues of using a single testing environment.

#Slow release cycles

The testing pipeline is green ✅ All the developers can test their features
The testing pipeline is green ✅ All the developers can test their features

With a single testing environment, the testing pipeline is a SPOF (Single Point of Failure) since every developer relies on it to finish their work.

The testing pipeline is broken ❌ All the developers can't test and release their features
The testing pipeline is broken ❌ All the developers can't test and release their features

A broken pipeline delays all the features that were supposed to be released. Plus, it becomes a very stressful experience for the person responsible for fixing it.

#Does not scale

The more the development team grows, the less they can ship fast since they are all contended to wait for their turn to run their tests in a single production-like environment.

A single testing environment does not scale with several developers
A single testing environment does not scale with several developers

#Waste of money (and not green 🌎)

Most of the time, development teams let their testing environment running 24/7, which is an important loss of money. Let's say your testing environment costs you $1000/month and you use it only 200 hours per week. By running it 24/7, you lose ~$700/month. Plus, in a world where we need to take care of our planet, unused resources must be released.

#Some pros

It will not be fair to criticize this kind of architecture since it is still very popular - and for very good reasons - the simplicity of setup and the ease of maintenance.

#The GitFlow Cure: Preview Environments

A valid solution that would be to provide a dedicated testing environment for every Pull Request - this is what we call Ephemeral Environment or Preview Environment. The concept is simple. Instead of being forced to merge your feature into a staging branch to test the feature in a single testing environment, a production-like environment is created for each Pull Request opened.

Here is an example of what Qovery does when you create a new Pull Request - a production-like environment is created!
Here is an example of what Qovery does when you create a new Pull Request - a production-like environment is created!

The environment will have everything similar (backend, frontend, database...) to the production to test in the best conditions. Developers, QA, Product Managers, and all people in the product development can share Preview URLs to test and validate the new feature.

Once the Pull Request is merged or closed, the environment is destroyed, and the resources are released! Then developers can now test and release features in parallel without having to wait for each other! The GitFlow is fixed!

Modern Release GitFlow with Preview Environments
Modern Release GitFlow with Preview Environments

Since Preview Environments are dynamic, on-demand, and created automatically, they provide additional benefits such as:

  • being always in sync with the production
  • cost-efficient since they are created only when necessary and destroyed when no longer used

Here is a demo example of a Preview Environment with Qovery

The only reproach we can do on Preview Environments is that it is complex to build a reliable system, working with full-stack applications and microservices. Plus, the maintenance cost can be higher than a single static testing environment.

#Conclusion

In this article, we have seen how to reconcile the GitFlow methodology with a testing flow. Preview Environment is the key to helping the developers team to test and release features faster than before. Even if implementing a PReview Environment system is complex, solutions exist - Qovery, for instance, provides a platform to get the Preview Environments in less than 30 minutes with zero maintenance cost.

Your Favorite Internal Developer Platform

Qovery is an Internal Developer Platform Helping 50.000+ Developers and Platform Engineers To Ship Faster.

Try it out now!
Your Favorite Internal Developer Platform
Qovery white logo

Your Favorite Internal Developer Platform

Qovery is an Internal Developer Platform Helping 50.000+ Developers and Platform Engineers To Ship Faster.

Try it out now!
Engineering