Git Strategies for DevOps By Stakater
Introduction Source versioning ● core activity in software development. ● Distributed source versioning systems e.g. git ○ agile and collaborative approach ● Enterprise-grade git cloud services ○ Github ○ Gitlab ○ Bitbucket, etc.
Versioning Strategy
Versioning strategy Semantic Versioning (SemVer) ● Solution for dependency versioning hell ● intuitive way to track and understand versioning ● Useful for external as well as internal dependencies ○ Microservices architecture ● Version syntax: X.Y.Z ○ X: major version number - backwards incompatible features ○ Y: minor version number - backwards compatible features ○ Z: patch number - backwards compatible bug fixes
Branching Strategy
Development workflow Base branch ● Usually "master" ● Protected branch. No direct commits. Development branch ● Branch for a feature or fix ● Create Pull Request once changes are ready
Development workflow Github settings for branch protection
Development workflow Pull Request ● Notifications ○ Slack, email, etc. ○ On creation, approval and merge. ● Checks for merging ○ Approval/code review by a peer or lead ○ Jenkins CI pipeline
Development workflow Github Pull Request: pending checks and review
Development workflow Github Pull Request: CI pipeline check passed
Development workflow Github Pull Request: checks and review completed
Development workflow PR merged -> Jenkins release pipeline is triggered ● release version bumped ○ tagged in git ○ updated within files e.g. helm chart yaml, package.json, version file, etc. ● release pushed to Nexus
Version bump Version number ● Maintained in .version file ● major/minor version number bumped by developer in file ● patch number bumped in CD pipeline Project Version file
Repository Structure
GitOps Two separate repos ● Code repo ○ Code of project ○ Built to artifact and/or docker image and/or helm chart ● Config repo ○ Defines deployment configuration ○ Which docker image or helm chart to use ○ Number of replicas ○ Deployment namespace ○ etc.
Contact Email: hello@stakater.com Web: http://stakater.com Opensource: https://github.com/stakater/

Git strategies for DevOps