Adapting the git-flow model for pre-production environments

I am thinking of extending the git -flow model for my current workstation due to a specific scenario. But my script is so widespread that I am surprised that no one has done this before with the git-flow model, and it makes me think that I missed the obvious problem. My question is: is my proposed extension underestimated?

Scenario: I have several development groups that develop from a common code base, and we release releases through several (persistent) environments: first into the system integration environment (SIT), then into the UAT environment, then pre-prod, and finally to production. This is strictly consistent, although any release candidate may fail in any environment, and so do not do this further. Thus, each subsequent environment is simply a slower version of the previous environment.

We introduce git for version control, we need a workflow, and git -flow looks like a good start.

We asked ourselves how to capture (that is, how to find out) what in every environment at any time. The git -flow model apparently has two main states: master and develop . They have an "endless life span." Other branches are "maintenance branches" with a "limited lifetime." They exist only to enable development and move from development to production (through a temporary state of liberation). The git-flow model is based on the transition from development to release.

However, this does not logically reflect our scenario with its multi-stage version. Of course I'm fine with the develop branch. And the master branch clearly corresponds to our production environment. git -flow's original description says this to master :

Therefore, every time changes are merged back into master, this is a new product release by definition. We are prone to this very strictly, so theoretically we could use a git hook script to automatically build and deploy our software on our production servers every time there was a fix on the main server.

Since master is a continuous recording of production, it seems consistent that we must extend the git-flow model to have the appropriate branches for SIT, UAT, and pre-prod. After all, they are persistent environments with strict release procedures. They just change a little faster than production.

These additional, persistent branches are between develop and master , as the corresponding environments do.

Now that means it's easy to track releases in each environment and the status of each environment. And merging is simpler for everyone: the SIT branch requires merging from develop , the UAT branch requires merging from the SIT branch, the pre-prod branch requires merging from the UAT branch, and finally, the master branch (for production) requires merging from the pre-prod branch. Each subsequent branch is simply a slower version of the previous branch.

Did I miss something?

+7
git deployment release-management git-flow
source share
1 answer

There is no reason why I can adapt the stream to your model. You say that you work sequentially SIT โ†’ UAT โ†’ Pre-Prod. Fine. After the development is stable (that is, all the functions to be released are the final processing [ed]), then do a release start and move it to your SIT platform for QA. After the release begins, development can continue in the develop branch. master remains static until release is complete.

Once the QA is executed, the release branch moves to the UAT. The UAT passes and the code goes into standby mode and you execute release finish to merge back into master / develop.

master should always be a reflection of what is currently on a live platform, while develop is a reflection of code in active development. There is a static section in the release branches against which bug fixes are applied (no new functions ever fall into this branch or you do not use git-flow ).

Based on your description, I would be inclined to say that you misunderstood the git-flow model, because from what I see, it fits perfectly into the scenario you described, all you need to take care during SIT โ†’ UAT โ†’ Pre -Prod - release branch, โ€œforgetโ€ master / develop even at this stage.

Reply to comments

Since I first published this answer, several comments have been made that have raised questions about how the model works in different scenarios.

  • Customer requested improvements to existing features

Answer:

NOT NOT (I canโ€™t stress this enough) allow you to add new features / improvements to the release branch. This is a creep area. New features - new work. They must be paid separately and must be treated separately. Regardless of whether your customer is your own company or a third party, the only thing they understand is value. Tell them that if they interrupt the release, it will delay it [indefinitely] or the existing testing will suffer. Relate to the release branch, just like master . It is sacred. Only bug fixes are allowed.

  1. Branch longevity

If your release branch lasts several months, your release cycle is too long. I worked in those places where the release cycle, on average, every 3 weeks and in other places where we released every couple of days. 3 weeks should be enough time for QA and UAT for the release branch. If you look at a longer cycle, I would say that the company is not flexible and

  • git -flow is the wrong branching strategy (doubtfully, it works in almost any scenario if it is carefully managed)

  • You need to challenge the company why the long cycle

  • (most likely) - you don't understand git-Flow

    1. Ci

I used git-Flow very successfully with CI. Although these were mainly Jenkins and Bamboo, he also works with Travis CI.

A Git commits-based hook is how any branch works. The best examples that I used are automatically created as soon as the commit (or series of commits) is transferred to the remote control, then the hook starts and calls the CI platform. The CI platform then finds the related job (either using the built-in templates or using a third-party module) to start the build.

My personal setup is to call a local Jenkins instance when:

  • I create a branch (creates a new task in the local installation of jenkins aimed at the current branch)
  • I commit (starts building a local instance of the current branch)
  • Local assembly passages, can automatically click on the remote
  • I push the new branch (creates the target assembly in the remote CI
  • I push commits (starts a remote CI instance)
  • I delete the local branch (deletes the local job)
  • Deletes a remote branch (deletes a remote job)
  • I raise a merge request (soft merge function / A into development and tests - tests fail, automatically reject deviations)

This requires some configuration, but it is possible with any modern CI platform.

Like everything else, the rules for using git-Flow are just recommendations. There are no hard and fast rules. If you want a long-lasting release branch, then your choice BUT , if you do not pay attention to them, you will get a different code base, which will be hell to unite.

git-Flow, like everything that comes from the * nix toolkit, is just a way to work, and there is a lot of choice with it. A tool and a workflow is nothing more than a wrapper on GIT. How you decide to implement it is entirely up to you.

+6
source share

All Articles