my-git

GitOps and Config as Code

English 中文

Original Links:

The boundaries of Git have expanded from code to configurations, infrastructure, release, and organizational processes.

For engineering teams, Git not only stores source code but also records the change history of configurations, infrastructure, and release strategies.

1. Why Configurations Should Enter Git

If configuration changes only exist in an admin backend, these problems easily arise:

After incorporating configurations into the Git workflow, existing capabilities can be reused:

2. Inspiration from Airbnb Sitar

Configuration management practices like Airbnb Sitar show that dynamic configurations also require engineering governance.

Key point: After configuration files enter the repository, configuration changes must also go through:

PR -> validation -> review -> staged rollout -> monitoring -> rollback

This is very similar to code releases.

3. Inspiration from Spotify Declarative Infrastructure

Spotify manages infrastructure configurations alongside source code, gaining peer review and audit trails through a GitOps workflow.

Its key points:

4. Automated Changes Should Also Go Through PRs

Cases like Spotify fleet-wide refactoring remind us that automated refactoring cannot bypass collaboration workflows.

Large-scale automated changes should:

This also has direct implications for the AI era. AI-generated changes, batch changes from local scripts, and automatic platform remediations should all return to PRs, Reviews, CI, and release records.

5. Implementation Recommendations for Teams

  1. Incorporate high-risk configurations into Git management first
  2. Enable CODEOWNERS in the configuration repository
  3. Configuration changes must go through PRs
  4. CI validates formats, semantics, and risks
  5. Release systems should track configuration versions
  6. Retain emergency change paths, but ensure there are audit records

6. Suitable Scenarios

Suitable for:

Unsuitable for: