Applies to:
- Liquibase Secure (Pro)
- Liquibase Community (Open Source)
Summary:
There are two common approaches to using Liquibase in Jenkins.
- Liquibase is installed on the Jenkins agent
- Liquibase Docker image on the Jenkins agent
This article will showcase the two workflows that can be used for Liquibase inside Jenkins. It does not cover best practices for a Jenkins workflow with Liquibase or how to configure more specific settings (storing credentials, using a source control manager, etc).
Environment Conditions:
- Jenkins
- Liquibase
How to use Liquibase installed on the Jenkins agent
- On the Jenkins agent, download and install any Liquibase version.
- In the pipeline script or Jenkins file, run any of the Liquibase shell commands. For example:
pipeline { agent any stages { stage("Liquibase Pre Check") { steps { sh 'liquibase --version' } } } }
- Running a Jenkins pipeline job will result in the Liquibase command getting executed.
How to use the Liquibase Docker image on the Jenkins agent
- In the pipeline script or Jenkins file, set the agent to be the Docker image for Liquibase. For example:
pipeline { agent { docker { image 'liquibase/liquibase:version' reuseNode true } } stages { stage("Liquibase Pre Check") { steps { sh 'liquibase --version' } } } }
- For version, set the version to any Liquibase found on the in Official Liquibase Docker images page on Docker Hub.
Comments
0 comments
Article is closed for comments.