DevOps help for Cloud Platform Engineers
  • Welcome!
  • Quick Start Guide
  • About Me
  • CV
  • 🧠DevOps & SRE Foundations
    • DevOps Overview
      • Engineering Fundamentals
      • Implementing DevOps Strategy
      • DevOps Readiness Assessment
      • Lifecycle Management
      • The 12 Factor App
      • Design for Self Healing
      • Incident Management Best Practices (2025)
    • SRE Fundamentals
      • Toil Reduction
      • System Simplicity
      • Real-world Scenarios
        • AWS VM Log Monitoring API
    • Agile Development
      • Team Agreements
        • Definition of Done
        • Definition of Ready
        • Team Manifesto
        • Working Agreement
    • Industry Scenarios
      • Finance and Banking
      • Public Sector (UK/EU)
      • Energy Sector Edge Computing
  • DevOps Practices
    • Platform Engineering
    • FinOps
    • Observability
      • Modern Practices
  • 🚀Modern DevOps Practices
    • Infrastructure Testing
    • Modern Development
    • Database DevOps
  • 🛠️Infrastructure as Code (IaC)
    • Terraform
      • Getting Started - Installation and initial setup [BEGINNER]
      • Cloud Integrations - Provider-specific implementations
        • Azure Scenarios
        • AWS Scenarios
        • GCP Scenarios
      • Testing and Validation - Ensuring infrastructure quality
        • Unit Testing
        • Integration Testing
        • End-to-End Testing
        • Terratest Guide
      • Best Practices - Production-ready implementation strategies
        • State Management
        • Security
        • Code Organization
        • Performance
      • Tools & Utilities - Enhancing the Terraform workflow
        • Terraform Docs
        • TFLint
        • Checkov
        • Terrascan
      • CI/CD Integration - Automating infrastructure deployment
        • GitHub Actions - GitHub-based automation workflows
        • Azure Pipelines - Azure DevOps integration
        • GitLab CI - GitLab-based deployment pipelines
    • Bicep
      • Getting Started - First steps with Bicep [BEGINNER]
      • Template Specs
      • Best Practices - Guidelines for effective Bicep implementations
      • Modules - Building reusable components [INTERMEDIATE]
      • Examples - Sample implementations for common scenarios
      • Advanced Features
      • CI/CD Integration - Automating Bicep deployments
        • GitHub Actions
        • Azure Pipelines
  • 💰Cost Management & FinOps
    • Cloud Cost Optimization
  • 🐳Containers & Orchestration
    • Containerization Overview
    • Docker
      • Dockerfile Best Practices
      • Docker Compose
    • Kubernetes
      • CLI Tools - Essential command-line utilities
        • Kubectl
        • Kubens
        • Kubectx
      • Core Concepts
      • Components
      • Best Practices
        • Pod Security
        • Security Monitoring
        • Resource Limits
      • Advanced Features - Beyond the basics [ADVANCED]
        • Service Mesh
        • Ingress Controllers
          • NGINX
          • Traefik
          • Kong
          • Gloo Edge
      • Troubleshooting - Diagnosing and resolving common issues
        • Pod Troubleshooting Commands
      • Enterprise Architecture
      • Health Management
      • Security & Compliance
      • Virtual Clusters
    • OpenShift
  • Service Mesh & Networking
    • Service Mesh Implementation
  • Architecture Patterns
    • Data Mesh
    • Multi-Cloud Networking
    • Disaster Recovery
    • Chaos Engineering
  • Edge Computing
    • Implementation Guide
    • Serverless Edge
    • IoT Edge Patterns
    • Real-Time Processing
    • Edge AI/ML
    • Security Hardening
    • Observability Patterns
    • Network Optimization
    • Storage Patterns
  • 🔄CI/CD & GitOps
    • CI/CD Overview
    • Continuous Integration
    • Continuous Delivery
      • Deployment Strategies
      • Secrets Management
      • Blue-Green Deployments
      • Deployment Metrics
      • Progressive Delivery
      • Release Management for DevOps/SRE (2025)
    • CI/CD Platforms - Tool selection and implementation
      • Azure DevOps
        • Pipelines
          • Stages
          • Jobs
          • Steps
          • Templates - Reusable pipeline components
          • Extends
          • Service Connections - External service authentication
          • Best Practices for 2025
          • Agents and Runners
          • Third-Party Integrations
          • Azure DevOps CLI
        • Boards & Work Items
      • GitHub Actions
      • GitLab
        • GitLab Runner
        • Real-life scenarios
        • Installation guides
        • Pros and Cons
        • Comparison with alternatives
    • GitOps
      • Modern GitOps Practices
      • GitOps Patterns for Multi-Cloud (2025)
      • Flux
        • Overview
        • Progressive Delivery
        • Use GitOps with Flux, GitHub and AKS
  • Source Control
    • Source Control Overview
    • Git Branching Strategies
    • Component Versioning
    • Kubernetes Manifest Versioning
    • GitLab
    • Creating a Fork
    • Naming Branches
    • Pull Requests
    • Integrating LLMs into Source Control Workflows
  • ☁️Cloud Platforms
    • Cloud Strategy
    • Azure
      • Best Practices
      • Landing Zones
      • Services
      • Monitoring
      • Administration Tools - Platform management interfaces
        • Azure PowerShell
        • Azure CLI
      • Tips & Tricks
    • AWS
      • Authentication
      • Best Practices
      • Tips & Tricks
    • Google Cloud
      • Services
    • Private Cloud
  • 🔐Security & Compliance
    • DevSecOps Overview
    • DevSecOps Pipeline Security
    • DevSecOps
      • Real-life Examples
      • Scanning & Protection - Automated security tooling
        • Dependency Scanning
        • Credential Scanning
        • Container Security Scanning
        • Static Code Analysis
          • Best Practices
          • Tool Integration Guide
          • Pipeline Configuration
      • CI/CD Security
      • Secrets Rotation
    • Supply Chain Security
      • SLSA Framework
      • Binary Authorization
      • Artifact Signing
    • Security Best Practices
      • Threat Modeling
      • Kubernetes Security
    • SecOps
    • Zero Trust Model
    • Cloud Compliance
      • ISO/IEC 27001:2022
      • ISO 22301:2019
      • PCI DSS
      • CSA STAR
    • Security Frameworks
    • SIEM and SOAR
  • Security Architecture
    • Zero Trust Implementation
      • Identity Management
      • Network Security
      • Access Control
  • 🔍Observability & Monitoring
    • Observability Fundamentals
    • Logging
    • Metrics
    • Tracing
    • Dashboards
    • SLOs and SLAs
    • Observability as Code
    • Pipeline Observability
  • 🧪Testing Strategies
    • Testing Overview
    • Modern Testing Approaches
    • End-to-End Testing
    • Unit Testing
    • Performance Testing
      • Load Testing
    • Fault Injection Testing
    • Integration Testing
    • Smoke Testing
  • 🤖AI Integration
    • AIops Overview
      • Workflow Automation
      • Predictive Analytics
      • Code Quality
  • 🧠AI & LLM Integration
    • Overview
    • Claude
      • Installation Guide
      • Project Guides
      • MCP Server Setup
      • LLM Comparison
    • Ollama
      • Installation Guide
      • Configuration
      • Models and Fine-tuning
      • DevOps Usage
      • Docker Setup
      • GPU Setup
      • Open WebUI
    • Copilot
      • Installation Guide
      • VS Code Integration
      • CLI Usage
    • Gemini
      • Installation Guides - Platform-specific setup
        • Linux Installation
        • WSL Installation
        • NixOS Installation
      • Gemini 2.5 Features
      • Roles and Agents
      • NotebookML Guide
      • Cloud Infrastructure Deployment
      • Summary
  • 💻Development Environment
    • Tools Overview
    • DevOps Tools
    • Operating Systems - Development platforms
      • NixOS
        • Installation
        • Nix Language Guide
        • DevEnv with Nix
        • Cloud Deployments
      • WSL2
        • Distributions
        • Terminal Setup
    • Editor Environments
    • CLI Tools
      • Azure CLI
      • PowerShell
      • Linux Commands
      • YAML Tools
  • 📚Programming Languages
    • Python
    • Go
    • JavaScript/TypeScript
    • Java
    • Rust
  • 📖Documentation Best Practices
    • Documentation Strategy
    • Project Documentation
    • Release Notes
    • Static Sites
    • Documentation Templates
    • Real-World Examples
  • 📋Reference Materials
    • Glossary
    • Tool Comparison
    • Recommended Reading
    • Troubleshooting Guide
  • Platform Engineering
    • Implementation Guide
  • FinOps
    • Implementation Guide
  • AIOps
    • LLMOps Guide
  • Development Setup
    • Development Setup
Powered by GitBook
On this page
  • Popular Source Control Systems
  • Sections within Source Control
  • Goal
  • Modern Source Control Patterns
  • Trunk-Based Development
  • Monorepo vs. Multirepo
  • GitOps Workflow
  • Infrastructure as Code Management
  • General Guidance
  • Creating a new repository
  • Conventional Commits
  • Contributing to an existing repository
  • Multi-Cloud Source Control Practices
  • Mixed DevOps Environments
  • Resources
Edit on GitHub
  1. Source Control

Source Control Overview

PreviousUse GitOps with Flux, GitHub and AKSNextGit Branching Strategies

Last updated 3 hours ago

Source control (or version control) is fundamental to modern DevOps practices. It provides a single source of truth for both application code and infrastructure definitions. This guide covers best practices for implementing effective source control strategies across cloud providers.

Popular Source Control Systems

  • GitHub - Widely used for public and private repositories with excellent CI/CD integration

  • GitLab - Self-hosted or SaaS platform with built-in CI/CD capabilities

  • Azure DevOps - Microsoft's comprehensive DevOps platform with integrated work tracking

  • Bitbucket - Atlassian's Git solution that integrates with their suite of products

Sections within Source Control

Goal

  • Following industry best practice to work in geo-distributed teams which encourage contributions across organizations

  • Improve code quality by enforcing reviews before merging into main branches

  • Improve traceability of features and fixes through a clean commit history

  • Enable GitOps workflows for infrastructure and application deployments

  • Support multi-cloud environments with consistent practices

Modern Source Control Patterns

Trunk-Based Development

Trunk-based development is a source control pattern where developers collaborate on code in a single branch (trunk/main), using feature flags and other techniques to disable incomplete code in production.

Key characteristics:

  • Short-lived feature branches (typically less than 2 days)

  • Frequent merges to the main branch (at least daily)

  • Comprehensive automated testing

  • Feature toggles to manage incomplete features

# Example workflow
git checkout -b feature/add-monitoring
# Make changes
git commit -am "Add Prometheus metrics endpoint"
# Pull latest changes from main
git pull origin main --rebase
# Run tests
npm test
# Push and create PR
git push -u origin feature/add-monitoring
# PR is reviewed and merged quickly (same day if possible)

Monorepo vs. Multirepo

Monorepo

A monorepo stores multiple projects in a single repository.

Advantages:

  • Simplified dependency management

  • Atomic changes across projects

  • Unified versioning

  • Easier code sharing and refactoring

Disadvantages:

  • Can become unwieldy for very large projects

  • Requires more sophisticated build tooling

  • Access control is less granular

Multirepo

A multirepo uses separate repositories for different projects or services.

Advantages:

  • Clear ownership boundaries

  • Fine-grained access control

  • Focused scope per repository

  • Independent release cycles

Disadvantages:

  • Challenging cross-project changes

  • Dependency management complexity

  • Version compatibility issues

Decision criteria:

  • Team size and structure

  • Project architecture (monolith vs microservices)

  • Deployment frequency requirements

  • Security and access control needs

GitOps Workflow

GitOps uses Git repositories as the source of truth for declarative infrastructure and applications.

Core principles:

  1. The entire system is described declaratively

  2. The canonical desired system state is versioned in Git

  3. Approved changes can be automatically applied to the system

  4. Software agents ensure correctness and alert on drift

Example GitOps workflow with Flux:

# Example Flux GitRepository resource
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: infrastructure
  namespace: flux-system
spec:
  interval: 1m
  url: https://github.com/organization/infrastructure
  ref:
    branch: main

Infrastructure as Code Management

Best practices for managing Infrastructure as Code in source control:

  1. Structure repositories effectively

    • Separate application code from infrastructure code

    • Organize by environment, region, or component

    infrastructure/
    ├── modules/           # Reusable infrastructure components
    ├── environments/      # Environment-specific configurations
    │   ├── dev/
    │   ├── staging/ 
    │   └── production/
    └── platform/          # Shared platform resources
  2. Version infrastructure resources

    • Use semantic versioning for infrastructure modules

    • Tag stable infrastructure releases

    # Tag infrastructure releases
    git tag -a "infra/v1.2.0" -m "Added VPC peering and updated security groups"
  3. Handle state files securely

    • Never store state files with secrets in source control

    • Use remote state with appropriate access controls

    # Terraform remote state example
    terraform {
      backend "s3" {
        bucket         = "terraform-state"
        key            = "prod/network/terraform.tfstate"
        region         = "us-west-2"
        encrypt        = true
        dynamodb_table = "terraform-locks"
      }
    }
  4. Manage secrets properly

    • Use secret management services (AWS Secrets Manager, Azure Key Vault)

    • Consider solutions like SOPS or Vault for encrypted secrets in Git

General Guidance

Creating a new repository

When creating a new repository, the team should at least do the following:

  • Agree on the branch, release, and merge strategy

  • Configure CI/CD pipelines to run on PR creation

  • Set up automated linting and security scanning

  • For public repositories the default branch should contain the following files:

Conventional Commits

Using conventional commits improves repository readability and enables automated versioning:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Common types include:

  • feat: A new feature

  • fix: A bug fix

  • docs: Documentation changes

  • chore: Routine tasks, maintenance

  • refactor: Code change that neither fixes a bug nor adds a feature

  • test: Adding or correcting tests

  • ci: Changes to CI configuration

Example:

feat(api): add endpoint for user authentication

Implement JWT-based authentication for the API service.

BREAKING CHANGE: `Authorization` header now required for protected routes

Contributing to an existing repository

When working on an existing project:

  1. git clone the repository

  2. Review the project's README.md and CONTRIBUTING.md files

  3. Understand the team's branch, merge and release strategy

  4. Follow the established workflow and coding standards

# Clone the repository
git clone https://github.com/organization/project.git

# Create a feature branch
git checkout -b feature/implement-monitoring

# Make changes, commit using conventional commits
git commit -m "feat(monitoring): add Prometheus metrics endpoint"

# Push changes and create a pull request
git push -u origin feature/implement-monitoring

Multi-Cloud Source Control Practices

When managing infrastructure for multiple cloud providers:

  1. Unified Repository Structure

    • Use consistent naming conventions across providers

    • Organize by capability rather than by provider when possible

  2. Provider Abstractions

    • Consider using abstraction layers in IaC

    • Implement consistent tagging across cloud providers

  3. Cross-Provider Testing

    • Test infrastructure changes across all targeted cloud environments

    • Use matrix CI/CD jobs to validate across providers

Mixed DevOps Environments

For most engagements, having a single hosted DevOps environment (i.e., Azure DevOps) is the preferred path, but there are times when a mixed DevOps environment (e.g., Azure DevOps for Agile/Work item tracking & GitHub for Source Control) is needed due to customer requirements. When working in a mixed environment:

  • Use integrations between systems where available (Azure Boards GitHub App)

  • Manually reference work items in commits with standard formats (e.g., AB#123)

  • Ensure that the scope of work items / tasks align with PR's

  • Consider automation tools like GitHub Actions to sync state between systems

  • Document the workflow clearly to avoid confusion

Resources

Consistency is important, so agree to the approach as a team before starting to code. Treat this as a design decision, so include a design proposal and review, in the same way as you would document all design decisions (see and ).

Define the merge strategy ()

Lock the default branch and merge using

Agree on (e.g. feature/add-monitoring or user/your_alias/feature_name)

Establish

- Official Git documentation

- Microsoft's DevOps platform

- GitHub documentation and guides

- GitLab documentation

- Interactive Git tutorial

- Commit message convention

- A lightweight branch-based workflow

- Core GitOps concepts and practices

Working Agreements
Design Reviews
linear or non-linear
pull requests (PRs)
branch naming
branch/PR policies
LICENSE
README.md
CONTRIBUTING.md
Git
Azure DevOps
GitHub
GitLab
Learn Git Branching
Conventional Commits
GitHub - Removing sensitive data from a repository
GitHub Flow
GitOps Principles
Merge Strategies
Branch Naming
Versioning
Working with Secrets
Git Guidance
Monorepo vs. Multirepo
GitOps Workflow
Infrastructure as Code Management