Gitflow for DevOps¶

Gitflow for DevOps is an agreed workflow for software development and operations teams to manage their software, code and configuration in different environments and stages in a unified way. It is based on the Gitflow branching model and is adapted to the needs of DevOps teams delivering a self-service platform to developers. The model is opinionated but is designed to be a baseline for future extensions.
The Overall Context¶
The enterprise Acme to own the domain acme.com and have in house operations and development teams.
We define the enterprise Acme to use the following software:
OpenShiftfor CloudArgo CDfor GitOps DeploymentsGitLabfor Software Life Cycle ManagementAnsiblefor infrastructure as codeBackstagefor Inventory ManagementActive DirectoryorEntrafor IAM
We define the enterprise Acme to build the following software:
* Phippy and Goldie are apps that Acme produces.
* Phippy is the frontened facing app your clients love.
* Goldie is a postgres database operator being a core service of your self-service platform.
* Phippy is a one single instance app that runs on one of your production cluster.
* Goldie is a one cluster service that runs on one or all the clusters.
* Phippy is produced by Team A a team of PHP developers.
* Goldie is produced by Team B a team of devops.
* Phippy and Goldie are shipped via Argo CD and are wrapped in Helm.
* Phippy and Goldie are developed with the same git workflow as well as other parts of infrastructue (ansible, terraform).
* Git workflow always produces semver versions that are tested through stages.
* semver release versions are controlled and managed through conventionalcommits.
Why to use GitFlow for DevOps?
- Strong versioning and release management
- Clear separation of development, staging, and production environments
- Better collaboration and code review processes
- Easier bug tracking, hotfix and change management
- Improved CI/CD integration, goverance and automation
- Compatible for Multi-agent Collaboration in a Model similar to GasTown
- A change to an environment / application is a commit of code and configuration bundled in a new version and potentially grouped with other changes.
- Promotion of a change is decoupled from the point in time of a commit. It is a decision that can be made at any time after the commit and can be automated or manual.
Read more about the anti-pattern of mapping branches to environments for GitOps deployments.
The advantages of GitFlow over trunk-based development for operations teams
- Allows a fast moving development branch for features and fixes without affecting the stability of the main branch.
- A clear seperation of development and production
- Favors scheduled and planned release cycles for governance and compliance, which is crucial for infrastructure and operations teams.
- Enables better collaboration and code review, promotion processes
Many devops favor trunk-based development for increased agility and faster delivery.
Gitflow Diagram¶
The following diagramm represents a unified and versioned workflow over all infrastructure projects using IaC ( ansible, terraform ), GitOps Deployments ( Argo CD, Flux ). Gitflow might be not strictly enforced within Acme, but gitflow can be also used in the development of Phippy.
Types of Software¶
Diffentiating between different types of software is important to understand the different lifecycles and workflows. The following table gives an overview of the different types of software in the context of a self-service platform for software development and operations.
| Abbr | Name | Purpose |
|---|---|---|
| cs | Cluster Service | A single internal service available in clusters configured by devops |
| ps | Platform Service | An instance of a service provided by the platform via operators for applications configured by software developers |
| app | Applications | All other software running on the platform and its services |
Lifecycle of infrastructure and software components¶
Definitions¶
An environment is a set of resources (servers, databases, configurations) where something is deployed.
A stage is a logical, ordered step in a deployment pipeline of a software or infrastructure component.
A release is a software or infrastructure component tagged with a specific version in its lifecycle and tested for the stage prd.
Stages¶
There at least three stages with a different meaning.
| Name | Purpose | Hints |
|---|---|---|
| dev | Used by all the devops and developers when they develop | - |
| int | Used by only CI/CD pipelines | - |
| prd | Where released software is deployed | - |
Team B: Platform Service Lifecycle¶
Team BdevelopsGoldiein thedevenvironment and stage.- A stage consists of one or more clusters isolated from other environments with clusters.
- An Environment is a set of resources (servers, networks, resource groups, configurations)
Goldiehas the stagesdev,intandprd.Goldieis being tested in the environmentintvia Continuous Integration Pipelines.Goldieis being released to the environment and stageprd.Team AusesPhippyin the environmentprd.
Team A: Software Lifecycle¶
Team AdevelopsPhippyin thedevenvironment and stage.- A stage consists of usually one namespace isolated from namespaces of other stages.
- An Environment is a set of mainly cluster internal resources (services, databases, configurations)
Phippyhas the stagesdev,intandprd.Phippyis being tested in the environmentintvia Continuous Integration Pipelines.Phippyis being released to the environment and stageprd.Team AusesPhippyin the environmentprd.
Naming conventions¶
- Namespaces can't start with numbers
For cluster services¶
| Context | Pattern | Example |
|---|---|---|
| Namespace | ${appid} | smtp |
| ArgoCD | ${apptype}-${appid}-${cluster} |
cs-smtp-prd01 |
For platform services¶
| Context | Pattern | Example |
|---|---|---|
| Namespace | OLM default or ps-${appid} |
ps-cloudnative-pg |
| ArgoCD | ${apptype}-${appid}-${cluster} |
ps-cloudnative-pg-prd01 |
See ps-cloudnative-pg chart for an example of a platform service with its own namespace and ArgoCD application.
For applications¶
| Context | Pattern | Example |
|---|---|---|
| Namespace | ${apptype}-${appid}-${env}-${instance} |
app-phippy-prd-01 or app-phippy-prd |
| ArgoCD | ${apptype}-${appid}-${env}-${instance} |
app-phippy-prd-01 or app-phippy-prd |
In case your app has just one instance drop ${instance}. In this example Phippy exists just once in all the stages.
See phippy chart for an example of an application with its own namespace and ArgoCD application.
Service and Application Distribution¶
Cluster Distribution over Infrastructure Stages¶
Provider specific environments and isolation¶
If you produce a self-service platform, your stages need isolation. Depending of the provider you have the following options for isolation:
Azure¶
- Tennats
- Subscriptions
VMWare¶
- Host Groups / Clusters in seperate Networks, storage pools, LUNs
Hetzner¶
- Projects
Bare Metal¶
- Different Hosts / Clusters in seperate Networks, LUNs, ...
Data Model for Inventory Management¶
In this section the model is implemented as an example with the inventory management system Backstage. It`s main purpose is the presentation and aggregation of data and systems as a hub.
.
Use cases for the inventory
- Developers want to find out which services and applications are available in the platform and how to use them.
- Support engineers can contact the right team responsible for a service or application.
- ArgoCD can read all those definitions to render the
app-of-apps - ArgoCD generate those definitions from the
app-of-appsas a catalog. - OpenShift can read those definitions to manage access control.
Abstract Entity Data Model¶
About goldie¶
- The platform service
goldieis aResourceof typedatabase goldieis part of the thesystemOpenShiftof thedomainacme.comTeam Bis aGroupand groups haveUsersTeam Bis the owner ofOpenShiftandgoldie.- A
Componentlikeapp-phippy-prdcan relate togoldie. goldiecan have references to the documentation, team, sources, deep links to argocd ...
About phippy¶
- The
phippyinstanceapp-phippy-prdis aComponentof typewebsitewith lifecyleproduction - It depends on a
Componentphippywhich is of typeProjectand belongs to theSystemBusiness Applicationsof the Domainacme.com Team Ais aGroupand groups haveUsers. ThatTeam Ais the owner of aProject- A Cluster is a
Resourceand aCompnentlikeapp-phippy-prdcan relate to it. app-phippy-prdcan have references to the documentation, team, sources, deep links to argocd, openshift ui ...
Catalog and consumers¶
- A catalog contributes compontents, resources or relations to the inventory model.
- A consumer consumes compontents, resources or relations from all the catalogs for its own configuration.
| Entity (type:name) | Catalog | Consumer |
|---|---|---|
resource:cluster/uuid-12345 |
OpenShift Cluster Catalog | ArgoCD, Project |
compontent:goldie |
Platform Service Catalog | ArgoCD |
compontent:phippy |
ArgoProject Catalog | - |
compontent:app-phippy-prd |
Argo Application Catalog | - |
compontent:app-phippy-tst |
Argo Application Catalog | - |
group:team-a |
User Catalog | ArgoCD / OpenShift |
group:team-b |
User Catalog | ArgoCD / OpenShift |
user:acme/team-b/bjoern.dieding |
User Catalog | ArgoCD / OpenShift |
user:acme/team-a/john.doe |
User Catalog | ArgoCD / OpenShift |
Further Reading: