August 21, 2024
What is GitOps? Automating version control to unite infrastructure, application, & database operations
See Liquibase in Action
Accelerate database changes, reduce failures, and enforce governance across your pipelines.
GitOps enables trust, efficiency, and streamlined processes for infrastructure, application, and database deployments by leveraging Git as the source of truth. This change-as-code approach fosters consistent and automated workflows, reduces manual intervention, and builds confidence in deployment accuracy while improving collaboration and speeding up delivery cycles across all environments.
Let’s break it down.
What is Git?
Git is the software industry-standard distributed version control system – a platform for keeping track of file updates, or in the case of developers, source code file versions. By distributing the source code across the entire development organization, every individual developer (or team) can work on their pieces of the application separately and then merge it into the source code repository. This enables:
- Collaboration (branching and merging)
- Tracking (version history)
- Reversion (rollback)
A Git repository, or repo, is simply the place where the source code is stored. The source code can be managed, analyzed, audited, and tracked in the repository. This sequential storage of change files allows the development team to easily jump back to a previous application version, which they might need to do if a recent release is problematic. By storing and documenting every version of the source code in the repository, developers have a single source of truth and a central point of collaboration.
The repo might be local or on a shared/cloud server, with Git providing the ability to synchronize changes from new and debugged code as it's committed or logged to the repo. Since Git collects code changes in a single trusted location, it enables reliable automation.
Git is a core concept of DevOps, since it enables traceability, collaboration, and both the safety and agility to manage small, frequent code changes. By branching and merging code development via Git, teams can enable seamless workflows – achieving Continuous Integration/Continuous Delivery (CI/CD).
Git vs GitOps
Git is officially an open source project founded in 2005. While it started as a system for tracking content — like files and code — Git has become a cornerstone of modern software development. Platforms like GitHub, Bitbucket, and GitLab showcase how Git’s core concepts have expanded beyond just software to infrastructure, thanks to GitOps. GitOps takes the Git methodology — version-controlled updates stored in a central repository — and applies it to operations, ensuring that code and infrastructure deployments are synchronized, automated, and reliable.
What is GitOps?
Git manages the code changes. That’s the foundation of modern software development, yet code changes don’t mean anything if they’re not deployed. The goal of GitOps is to bring code changes to life reliably and consistently.
GitOps operationalizes Git. It brings in capabilities to deploy and manage application and infrastructure code changes while using Git as the single source of truth. While Git manages code, GitOps manages the deployment and operational aspects using Git workflows.
GitOps is essentially about integrating Git with CI/CD pipelines to automate and streamline the deployment of applications and infrastructure. In GitOps, Git serves as the single source of truth, where all configuration and code changes are version-controlled. These changes are automatically deployed through CI/CD pipelines, ensuring that the actual state of the system matches the desired state defined in the Git repository. This approach enhances automation, consistency, and reliability in DevOps practices by leveraging Git’s core principles.
Much of the software development life cycle is already automated, but infrastructure often remains manual. GitOps addresses this gap by allowing teams to configure infrastructure as code and automate provisioning, bringing the same speed and efficiency to infrastructure management that DevOps brings to software deployment.
That leads into the core principles of GitOps, listed here and expanded upon later on:
- Infrastructure as code
- Git is declarative, immutable and reconcilable
- Git as the single source of truth
- CI/CD automation
- Observability and monitoring
GitOps fits into the overall culture of DevOps in that it unites developers with ops teams to seamlessly integrate code development, testing, deployment, and monitoring into a productivity loop.
DevOps & GitOps: What’s the difference?
While DevOps prescribes the philosophy, GitOps makes it a reality: giving developers a way to save and sync their code and operations teams ways to deploy code and manage supporting infrastructure.
DevOps is a way of doing things in software development organizations. More specifically, it’s an organization of application development teams, tech, and workflows with those of deployment operations teams. Instead of handling software releases – new or updated code – from developers in huge batches all at once in a waterfall approach, DevOps envisions a world where:
- Silos between development and operations disappear
- Teams openly and frequently communicate and collaborate on code creation and maintaining production environments
- Continuous feedback between teams optimizes development and operations
- Code changes are small and frequent
- Code is seamlessly integrated through operational stages
And ultimately, a software development lifecycle that operates at peak speed, efficiency, and quality. To achieve this, DevOps embraces certain core practices including:
- Version control
- Continuous integration/continuous delivery (CI/CD)
- Containerization
- Testing
- Automation
- Database change as code
- Infrastructure as Code (IaC)
- GitOps
So to contextualize, GitOps is a practice that supports DevOps alongside others, as listed above.
Is GitOps replacing DevOps?
No – and the question itself breaks down when you understand GitOps as part of DevOps. But it’s understandable to be confused by all the various “--Ops” categories (DevSecOps, DataOps, etc.).
GitOps brings DevOps best practices to life: version control, automation, testing, CI/CD, observability, monitoring, and more. Within the broader DevOps ecosystem, GitOps ensures a single source of truth for application and infrastructure code, as well as tools to automate, manage, and monitor them.
By preventing errors and inconsistencies from making it to production, GitOps enhances reliability, accelerates deployments, and ensures that all changes are thoroughly tested and verified. This directly supports DevOps by enabling CI/CD, fostering a culture of collaboration, and ensuring that both application and infrastructure code are deployed safely and efficiently, all of which contribute to the overall goal of delivering high-quality software quickly and reliably.
The same concepts should also be applied to databases and their subsequent schema changes. Database DevOps, including Git for the database, brings the change management process into sync with the rest of the pipeline.
Before digging into database GitOps, though, it’s smart to understand the core principles and benefits of GitOps itself.
GitOps core concepts
Through these core elements, GitOps streamlines development and deployment operations to support an automated, cohesive, and collaborative lifecycle. By treating infrastructure as code, GitOps ensures all configurations are consistently versioned, auditable, and recoverable. With Git as a single source of truth, teams can maintain transparency and collaboration, automate deployments to align the system’s actual state with its desired state, and respond quickly to issues with strong observability and monitoring.
Git as the single source of truth
GitOps builds on the principle of Git as a single source of truth. Any code, infrastructure, and configuration changes that enter the pipeline does so via Git workflows and repositories. This enables version control and traceability, making it easier for teams to track down specific changes for debugging, auditing, and other purposes.
At the core of GitOps, having a single source of truth (Git) is the foundation for accountability, collaboration, and transparency.
Declareable, immutable, and reconcilable
Declarative, immutable, and reconcilable principles bring essential solidity, trust, and operability to GitOps workflows.
A GitOps workflow must be declarative, meaning it defines the desired system state in a format that’s both human-readable and machine-readable. It must be immutable, ensuring that once changes are committed, they remain unchanged, providing a clear audit trail. And it must be reconcilable, continuously monitoring and correcting any drift between the actual and desired states, ensuring the system stays aligned with its intended configuration.
Infrastructure as Code
Infrastructure as Code (IaC) is the practice of managing and provisioning infrastructure through machine-readable configuration files, treating components like servers, networks, and storage as code. These configurations are stored in version control systems like Git, allowing teams to version, review, and test infrastructure changes just as they would with application code. This approach ensures consistency, repeatability, and automation in deploying and managing infrastructure, aligning it closely with DevOps practices.
Continuous delivery and automated deployments
In GitOps, continuous delivery and automated deployments are key to ensuring that infrastructure and applications are consistently and reliably updated. By using automation tools and CI/CD pipelines, changes are delivered and deployed in real-time, ensuring that the actual system state always matches the desired state defined in Git. This reduces manual intervention, speeds up deployments, and minimizes errors, making the entire process more efficient.
Observability and monitoring
Observability and monitoring are fundamental to maintaining system reliability and continuous optimization in GitOps. These tools continuously track the health and performance of both infrastructure and applications, providing teams with actionable insights and alerts when issues arise. By integrating observability into the GitOps workflow, teams can quickly detect, diagnose, and resolve problems, ensuring that systems remain stable, secure, and at peak performance.
These core components work together to simplify and optimize application and infrastructure deployment while improving collaboration and transparency for maximum reliability and efficiency. That’s a lot of buzzwords in one place – let’s break down an example workflow.
GitOps workflows
A GitOps workflow is the process in which all of these core components happen: the automated path from code development and repo commit to production and monitoring.
The typical GitOps workflow would proceed as:
- Developers commit changes to applications, infrastructure, or database schemas as code into the Git repository
- Code commits, approved pull requests or other actions in the Git repository trigger the CI pipeline automation that builds, tests, and packages the changes
- Once approved, the changes are automatically applied to lower environments by the CD tool
- Real-time monitoring tools observe deployments to provide metrics, feedback, and error detection
- Live environments are continuously checked by CD tools for drift or discrepancy against the Git-defined desired state, and automatically reconciled if needed
This simplified workflow would expand to serve the unique needs of each pipeline. But before even establishing a Git repository, teams that want to get started with GitOps need to first:
- Identify the application, infrastructure, and/or database pipeline that’s best suited to the shift to GitOps
- Analyze your exciting CI/CD tech stack and identify the GitOps tools you’ll need to fill the gaps
Obviously, one of those gaps will be the Git repository – so that’s a good place to start building out the tech stack. Once that’s established as the single source of truth, teams need to:
- Complete the CI/CD integration so Git commits trigger build, test, and deploy automations
- Implement monitoring and observability to track from development to release
- Optimize the GitOps workflow to achieve smooth, fast, reliable deployments
Then, GitOps can be expanded to the rest of the organization’s projects.
GitOps tools
Within the GitOps workflow, common GitOps tools fall into the categories of:
- Git hosting platforms that serve as the central repositories where code and configurations are version-controlled and managedsome text
- Examples: GitHub, GitLab, BitBucket
- CI/CD tools that automate build, test, and deployment processessome text
- Examples: Jenkins, Azure DevOps, GitHub Actions
- CD platforms that enable continuous deployment and ensure changes apply to live environmentssome text
- Examples: ArgoCD, FluxCD, Spinnaker
- Infrastructure as Code (IaC) platforms to define and manage code consistently and repeatablysome text
- Examples: Terraform, Ansible, CloudFormation
- Observability platforms that provide monitoring, reporting, and analytics capabilities to detect issues and optimize processessome text
- Examples: Prometheus, Grafana, DataDog, Splunk
- Database DevOps capabilities that align schema changes with code and infrastructure updates while enhancing consistency, security, and compliance some text
- Example: Liquibase
These tools cover the workflow from code commit to production monitoring and ongoing optimization – and complete the pipeline with application, infrastructure and database change as code. With optimal integration, they maximize the benefits of GitOps for every team.
GitOps benefits
Much like DevOps, GitOps enables faster, safer, and higher-quality application development and infrastructure deployment, bringing version control to application and infrastructure code that unites and protects team innovations.
Accelerate development and deployment
In operationalizing distributed version control, GitOps enables development teams to bring the core DevOps principle of smaller, more frequent deployments to life. GitOps teams can ship updates multiple times a day with the confidence that each has been adequately tested – but also can be easily rolled back, if needed.
Improve reliability
What would pipeline acceleration mean if those deployments aren’t high-quality and stable? Automating version control and rollbacks with GitOps processes makes it easy and uneventful to undo a problematic change, first of all. Plus, GitOps workflows enable the automated testing and collaborative reviews that ensure errors don’t make it to production to begin with.
Strengthen, streamline, and simplify security and compliance
By centralizing infrastructure change management into a single platform alongside application code updates, GitOps brings the reliability, automation, and cohesiveness of the rest of the CI/CD pipeline to the underlying systems. Uniting these workflows reduces the risk of downtime and outages, enabling a safe and secure environment for developers to work without worry.
Collaborate easier and more productively
In a GitOps workflow, DevOps best practices are built into standardized processes to maximize the value and ease of collaboration. With a streamlined and transparent workflow, teams can communicate and review code more quickly, provide immediate feedback, and let automation free up time for innovative discussions. With more collaboration happening more efficiently, productivity improves alongside developer satisfaction.
Optimize developer experience
GitOps should make the work-lives of developers as easy as possible. While maintaining reliability and quality, the GitOps framework aims to automate, standardize, and streamline as much of the application and infrastructure development and deployment process as possible. GitOps workflows are flexible to tools and languages preferred by specific development teams, empowering productivity without sacrificing comfort and familiarity. These processes also make it easy to revert changes and keep track of every operation.
Increase ROI of pipeline investments
When the development and infrastructure tech stacks are integrated and optimized for the GitOps workflow, their individual benefits break out of team or use case silos to spread value across the pipeline. By bringing infrastructure change management into the automated workflow, GitOps also helps optimize cloud resource usage, helping reign in costs that can easily run away. Efficient resource allocation and automated processes make it easier to manage expenses and efficiency while maintaining high performance.
These benefits stack up to greater business value, better user experiences, and happier technology teams. However, even some of the most mature GitOps organizations might fall short of complete pipeline integration – and complete capitalization on the benefits of GitOps – until they can bring database deployments into the workflow as well.
Database GitOps: Integrating schema change management
The current state of database schema change management for many organizations, even with GitOps workflows in place elsewhere, remains:
- Manual
- Non-standardized
- Inconsistent
- Devoid of tracking
Sound familiar? These database administration challenges are similar to what GitOps addresses for infrastructure management. With GitOps — and database GitOps — you can bring those deployments in line with application CI/CD.
Database GitOps brings CI/CD to the database by integrating schema change into the pipeline with:
- Code-based changes
- Small, frequent deployments
- Version control
- Automation
- Governance
- Tracking
- Drift detection
- Observability
By treating database change as code, schema migrations can be collaboratively developed and then merged, tested, and deployed with easy, self-service workflows. Automating database version control with a database DevOps platform like Liquibase enables standardized, secure processes and the same levels of granular tracking to match the rest of the pipeline.
By allowing teams to tap into the logs created through comprehensive automation, Liquibase unlocks database observability for transparency, traceability, and analytics. Other monitoring capabilities, like detecting schema drift and integrating with existing CI/CD analytics dashboards, bring database change management in line with GitOps principles.
Get started with Liquibase for database GitOps or dive deeper into database version control.