Preparing for Database Automation with Liquibase CI/CD
March 29, 2021
See Liquibase in Action
Accelerate database changes, reduce failures, and enforce governance across your pipelines.

Content updated September 2025
Key Takeaways
- Database automation improves safety, speed, and reliability by validating changes in lower environments before production.
- Liquibase provides commands and pipeline patterns to test deployments, rollbacks, and finalize changes within CI/CD.
- A structured process with Liquibase helps teams modernize workflows, reduce risk, and deliver database updates with confidence.
Introduction
If you are unsure how to begin automating your database workflows, you are not alone. Many teams still manage database changes manually or with limited automation. Moving to automated database change delivery is a recent development for most organizations. As your team adopts CI/CD best practices, it can be challenging to adapt your database change management process. Liquibase offers a robust set of features to help you modernize and standardize these workflows.
Drama-free deployments
Continuous integration and continuous delivery (CI/CD) is about more than just automating deployments. It is about building reliability, safety, quality, and repeatability into every release. Automated deployments in lower environments help validate both your delivery process and your database changes. This approach ensures that what reaches production is thoroughly tested and ready for release, minimizing incidents and surprises.
How to get started
That sounds great, but where to start? You’ve downloaded Liquibase and installed it, but what does a good pattern look like? Let’s walk through a simple example using this Microsoft Azure DevOps (ADO) pipeline definition to illustrate some concepts.
This is a basic YAML pipeline with a parameter to help us select our target environment when triggering the pipeline. There are three variables defined. One is a variable for selecting which changeset labels we want to deploy (defaulting to all of them). The other two variables serve as placeholders for redacting credentials in the command line. (Note: While this is not a security-focused post, it is worth a reminder at this point that everyone should be using a password vault of some kind to manage secrets in their automation flows). The rest of the pipeline runs a series of Liquibase commands in the shell of a demo Windows machine with an ADO agent and SQL Server installed on it.
Breaking down the steps and the logic behind them, there are four main phases:
- Basic readiness
- Test deploy
- Test rollback
- Finalize
You may have downloaded and installed Liquibase, but you might be wondering what a strong automation pattern looks like. Here is a simple example using this Microsoft Azure DevOps (ADO) pipeline definition to illustrate key concepts.
This example uses a basic YAML pipeline with a parameter to select your target environment at runtime. There are three variables: one for specifying which changeset labels to deploy (defaulting to all), and two for handling credentials securely. It is important to use a password manager or vault to protect secrets in your automation flows. The pipeline runs Liquibase commands on a demo Windows machine with an ADO agent and SQL Server installed.
The pipeline follows four main phases:
- Basic Readiness
- Test Deploy
- Test Rollback
- Finalize
Phase 1 - Basic Readiness
This phase checks that everything is ready for deployment. While you can add more quality checks later, this example covers three essential steps:
- Run liquibase validate to confirm the changelog syntax is correct.
- Use liquibase tag to set a marker in the target database, which also creates a rollback point.
- Execute liquibase status to log pending changes for traceability and troubleshooting.
- script: |
call c:\apps\liquibase\liquibase.bat --username=$(LBMSSQLUSERNAME) --password=$(LBMSSQLPASSWORD) --url jdbc:sqlserver://localhost:1433;database=cyclopsbi_${{ parameters.env }}; --labels=$(labels) validate
call c:\apps\liquibase\liquibase.bat --username=$(LBMSSQLUSERNAME) --password=$(LBMSSQLPASSWORD) --url jdbc:sqlserver://localhost:1433;database=cyclopsbi_${{ parameters.env }}; tag JOBID_$(Build.BuildId)
call c:\apps\liquibase\liquibase.bat --username=$(LBMSSQLUSERNAME) --password=$(LBMSSQLPASSWORD) --url jdbc:sqlserver://localhost:1433;database=cyclopsbi_${{ parameters.env }}; --labels=$(labels) status --verbose
workingDirectory: Liquibase
displayName: 'Verify Changes'
Phase 2 - Test Deploy
The objective here is to confirm that changes deploy as intended. The two key steps are:
- Run liquibase updateSQL to generate a dry run of all SQL statements that will be executed, providing visibility and supporting troubleshooting.
- Use liquibase update to perform the actual deployment and validate success.
- script: |
call c:\apps\liquibase\liquibase.bat --username=$(LBMSSQLUSERNAME) --password=$(LBMSSQLPASSWORD) --url jdbc:sqlserver://localhost:1433;database=cyclopsbi_${{ parameters.env }}; --labels=$(labels) updateSQL
call c:\apps\liquibase\liquibase.bat --username=$(LBMSSQLUSERNAME) --password=$(LBMSSQLPASSWORD) --url jdbc:sqlserver://localhost:1433;database=cyclopsbi_${{ parameters.env }}; --labels=$(labels) update
workingDirectory: Liquibase
displayName: 'Deploy Changes'
Phase 3 - Test Rollback
This phase validates the safety of your deployment process. You need to be confident that changes can be rolled back if needed. The steps are:
- Run liquibase rollbackSQL to view the SQL statements required to revert to the earlier tag, supporting traceability and troubleshooting.
- Use liquibase rollback to test the rollback in a lower environment, ensuring it works before relying on it in production.
- script: |
call c:\apps\liquibase\liquibase.bat --username=$(LBMSSQLUSERNAME) --password=$(LBMSSQLPASSWORD) --url jdbc:sqlserver://localhost:1433;database=cyclopsbi_${{ parameters.env }}; --labels=$(labels) rollbackSQL JOBID_$(Build.BuildId)
call c:\apps\liquibase\liquibase.bat --username=$(LBMSSQLUSERNAME) --password=$(LBMSSQLPASSWORD) --url jdbc:sqlserver://localhost:1433;database=cyclopsbi_${{ parameters.env }}; --labels=$(labels) rollback JOBID_$(Build.BuildId)
workingDirectory: Liquibase
displayName: 'Verify Deployment'
Phase 4 - Finalize
This final phase redeploys the changes removed in Phase 3. If you reach this step, you have validated your quality gates and rollback safety. You can proceed with a final deployment.
Run liquibase update to complete the deployment and finish the process.
- script: |
call c:\apps\liquibase\liquibase.bat --username=$(LBMSSQLUSERNAME) --password=$(LBMSSQLPASSWORD) --url jdbc:sqlserver://localhost:1433;database=cyclopsbi_${{ parameters.env }}; --labels=$(labels) update
workingDirectory: Liquibase
displayName: 'Finalize'
Summing it up
This example provides a starting point for teams new to database automation and CI/CD with Liquibase. By standardizing your workflow and automating database change management, you can deliver updates faster, with less risk and more control. Liquibase supports over 60 database platforms, giving you a unified approach for diverse environments. You can further enhance your process with additional Liquibase commands or integrate adjacent tools for greater governance, security, and visibility.
If you want to expand your Liquibase knowledge, consider free courses at Liquibase University. For expert guidance on implementing Liquibase at scale, reach out to our team. We are here to help you deliver database changes with confidence.
Frequently Asked Questions
Why automate database deployments with Liquibase?
Automation reduces risk, improves reliability, and ensures changes are tested and consistent across environments.
How does Liquibase support rollback testing?
Liquibase enables rollbackSQL and rollback commands, letting you validate rollback safety in lower environments before production.
Can I use Liquibase with my existing CI/CD tools?
Yes. Liquibase integrates easily with tools like Azure DevOps, Jenkins, and GitHub Actions, supporting pipelines across 60+ database platforms.
What’s the first step to database automation?
Start by defining a pipeline that includes validation, test deployments, rollback testing, and finalization—Liquibase commands make this simple.
Where can I learn more about Liquibase automation?
Free courses are available at Liquibase University, and you can connect with Liquibase experts for tailored guidance.