Liquibase Plugin Reference 26.1.x
The XL Deploy Liquibase plugin allows you to apply database changelogs and roll back database changes to deployment tags. The plugin runs the Liquibase CLI on a host configured in XL Deploy.
Requirements
- Install the Liquibase CLI on a host accessible by the XL Deploy server.
- Configure the host with access to the target database and the required database drivers.
- For Liquibase 4.11.0 and later, make
LIQUIBASE_HOMEavailable in the execution environment on the host. - Package the changelog files in a
liquibase.Changelogfolder artifact.
Limitations
- Rollback uses Liquibase tags rather than a changeset count or date.
- Changesets must support rollback for the selected target tag.
- Set the
logicalFilePathattribute on each changeset so that uploaded file paths do not affect changeset identification.
Configure a Liquibase Runner
Create a liquibase.Runner on the host where Liquibase is installed. Configure the database connection and Liquibase command settings:
| Property | Description |
| --- | --- |
| databaseUsername | Database username. When omitted, use the value in the Liquibase properties file. |
| databasePassword | Database password. When omitted, use the value in the Liquibase properties file. |
| databaseJDBCURL | JDBC connection URL. When omitted, use the value in the Liquibase properties file. |
| databaseJDBCDriver | JDBC driver class. When omitted, use the value in the Liquibase properties file. |
| driverClasspath | Java classpath for the database drivers. |
| liquibaseLauncher | Location of the Liquibase CLI. Defaults to /usr/local/bin. |
| isNoSQL | Set to true for a NoSQL database. Defaults to false. |
| liquibaseConfigurationPath | Path to the Liquibase properties file. |
| liquibaseExtraArguments | Additional arguments passed to the Liquibase command. |
Run Check Connection on the runner to verify database connectivity before deployment.
Configure a Changelog
Add a liquibase.Changelog folder artifact to the deployment package and map it to a liquibase.Runner.
| Property | Description |
| --- | --- |
| changeLogFile | Entry-point changelog file within the artifact. Required. |
| rollbackVersion | Integer used for the deployment rollback tag and version comparisons. |
| rollbackVersionPrefix | Prefix for the deployment rollback tag. Defaults to v. |
The deployment tag combines rollbackVersionPrefix and rollbackVersion. For example, prefix v and version 1 produce tag v1.
Use a stable logical path for each changeset:
<changeSet logicalFilePath="path-independent" author="example" id="1">
<!-- Database changes -->
</changeSet>
Deployment Behavior
Create
- Upload the changelog folder.
- Create the initial rollback tag,
xld_liquibase_base_version. - Apply the changelog.
- Create the deployment rollback tag.
Modify
- If the new
rollbackVersionis lower than the previous version, upload the previous deployment's changelog folder and roll back to the new deployment's tag. - Otherwise, upload the new changelog folder, apply the changelog, and create the deployment rollback tag.
Destroy
- Upload the previous deployment's changelog folder.
- Roll back to the initial rollback tag,
xld_liquibase_base_version.
For relational databases, the plugin runs updateSQL before update. When isNoSQL is true, it skips updateSQL.
CI Reference
Configuration Item Overview
Deployables
| CI | Description |
|---|---|
| liquibase.Changelog | Executed liquibase changelog (deployable) |
Deployeds
| CI | Description |
|---|---|
| liquibase.ExecutedChangelog | Executed liquibase changelog |
Containers
| CI | Description |
|---|---|
| liquibase.Runner | Liquibase CLI Configuration |
Configuration Item Details
liquibase.Changelog
| Type Hierarchy | file.Folder >> udm.BaseDeployableFolderArtifact >> udm.BaseDeployableArtifact >> udm.BaseDeployable >> udm.BaseConfigurationItem |
|---|---|
| Interfaces | udm.Artifact, udm.Deployable, udm.DeployableArtifact, udm.FolderArtifact, udm.SourceArtifact, udm.Taggable |
Executed liquibase changelog (deployable)
| Public properties | ||
|---|---|---|
|
|
|
changeLogFile: STRING
|
|
Name of the changelog file containing database changesets that Liquibase will execute. (string)
|
||
|
|
|
checksum: STRING
|
|
The checksum used to detect differences on the artifact. If not provided, it will be calculated by XL Deploy.
|
||
|
|
|
createTargetPath: STRING
|
|
Create the targetPath on the host if it does not exist.
|
||
|
|
|
credentials:
CI<credentials.Credentials>
|
|
Credentials of the URI.
|
||
|
|
|
defaultCopyStrategy:
CI<file.FileCopyStrategy>
|
|
Default copy strategy for this folder artifact.
|
||
|
|
|
excludeFileNamesRegex: STRING
|
|
Regular expression that matches file names that must be excluded from scanning
|
||
|
|
|
excludeFileNamesRegexToTranscode: STRING
|
|
A regex of file type that needs to be ignored for transcode
|
||
|
|
|
fileEncodings: MAP_STRING_STRING = { .+\.properties=ISO-8859-1 }
|
|
Specifies file encodings in this artifact. Key: regular expression matching file names; value: character set. Character set encoding is used for placeholder replacement and transcoding files to z/OS.
|
||
|
|
|
fileUri: STRING
|
|
The URI pointing to the (remote) location of the file this artifact represents
|
||
|
|
|
isRescanned: BOOLEAN
|
|
Indicates if the artifact has been rescanned
|
||
|
|
|
members: SET_OF_STRING
|
|
Only these files or directories will be extracted from the archive.
|
||
|
|
|
placeholders: SET_OF_STRING
|
|
Placeholders detected in this artifact
|
||
|
|
|
preScannedPlaceholders: BOOLEAN
|
|
Whether this artifact has been pre-scanned by the packager (ie. scanned for placeholders and checksum is set)
|
||
|
|
|
proxySettings:
CI<credentials.ProxySettings>
|
|
Proxy Settings for artifact location
|
||
|
|
|
rollbackVersion: STRING
|
|
A specific point in the database changelog history to which Liquibase will revert the database, undoing changes made after that version. (integer)
|
||
|
|
|
rollbackVersionPrefix: STRING
|
|
Prefix added to rollback tag. Defaults to 'v' (string) default(v)
|
||
|
|
|
scanPlaceholders: BOOLEAN = true
|
|
Whether to scan this artifact to replace placeholders when it is imported
|
||
|
|
|
stripComponents: STRING = 0
|
|
Number of leading folder levels (path components) to remove from each file path before extraction.
|
||
|
|
|
tags: SET_OF_STRING
|
|
If set, this deployable will only be mapped automatically to containers with the same tag.
|
||
|
|
|
targetPath: STRING
|
|
Path to which artifact must be copied to when being deployed.
|
||
|
|
|
targetPathShared: STRING
|
|
Is the targetPath shared by others on the host. When true, the targetPath is not deleted during undeployment; only the artifacts copied to it.
|
||
|
|
|
textFileNamesRegexToTranscode: STRING = .+\.(cfg | conf | config | ini | properties | props | txt | asp | aspx | htm | html | jsf | jsp | xht | xhtml | sql | xml | xsd | xsl | xslt)
|
|
Regular expression that matches file names of text files to transcode to EBCDIC
|
| Hidden properties | ||
|---|---|---|
|
|
|
executableFileNamesRegex: STRING = .+\.(sh | bat | exe | bin | py | app | cmd | pkg | run | bash | ps1)
|
|
Regular expression that matches file names of executable files. Matching files receive 0755 permissions when permissions are not available in the source archive entry stream.
|
||
|
|
|
textFileNamesRegex: STRING = .+\.(cfg | conf | config | ini | properties | props | txt | asp | aspx | htm | html | jsf | jsp | xht | xhtml | sql | xml | xsd | xsl | xslt)
|
|
Regular expression that matches file names of text files
|
||
|
|
|
boundTemplates:
SET_OF_CI<udm.Template>
|
|
The set of CI templates.
|
||
|
|
|
delimiters: STRING = {{ }}
|
|
The delimiters used indicate placeholders, defaults to '{{ }}'. This is a 5 character string with a space in the middle, the first two are the leading delimiter, the last two are the closing delimiter
|
||
|
|
|
isForceArchive: BOOLEAN = true
|
|
Force Archive
|
| Control task | Parameter CI | Attributes | Description |
|---|---|---|---|
| rescanArtifacts |
delegate = rescanArtifact |
No description. |
liquibase.ExecutedChangelog
| Type Hierarchy | udm.BaseDeployedArtifact >> udm.BaseDeployed >> udm.BaseConfigurationItem |
|---|---|
| Interfaces | udm.Artifact, udm.Deployed, udm.DerivedArtifact, udm.EmbeddedDeployedContainer |
Executed liquibase changelog
| Parent | ||
|---|---|---|
|
|
|
container:
CI<udm.Container>
|
|
The container on which this deployed runs.
|
| Public properties | ||
|---|---|---|
|
|
|
changeLogFile: STRING
|
|
Name of the changelog file containing database changesets that Liquibase will execute.
|
||
|
|
|
rollbackVersion: INTEGER
|
|
A specific point in the database changelog history to which Liquibase will revert the database, undoing changes made after that version.
|
||
|
|
|
deployable:
CI<udm.Deployable>
|
|
The deployable that this deployed is derived from.
|
||
|
|
|
placeholders: MAP_STRING_STRING
|
|
A Map containing all the placeholders mapped to their values. Special values are <ignore> or <empty>
|
||
|
|
|
rollbackVersionPrefix: STRING = v
|
|
Prefix added to rollback tag. Defaults to 'v'
|
| Hidden properties | ||
|---|---|---|
|
|
|
baseRollbackTag: STRING = xld_liquibase_base_version
|
|
Base Rollback Tag
|
||
|
|
|
boundConfigurationItems:
SET_OF_CI<udm.ConfigurationItem>
|
|
The set of created CIs.
|
liquibase.Runner
| Type Hierarchy | generic.Container >> generic.BaseGenericContainer >> udm.BaseContainer >> udm.BaseConfigurationItem |
|---|---|
| Interfaces | udm.Container, generic.GenericContainer, overthere.HostContainer, udm.Taggable |
Liquibase CLI Configuration
| Parent | ||
|---|---|---|
|
|
|
host:
CI<overthere.Host>
|
|
Host upon which the container resides
|
| Public properties | ||
|---|---|---|
|
|
|
databaseJDBCDriver: STRING
|
|
The JDBC driver class to use
|
||
|
|
|
databaseJDBCURL: STRING
|
|
JDBC connection URL for the database
|
||
|
|
|
databasePassword: STRING
|
|
Password for the specified database username.
|
||
|
|
|
databaseUsername: STRING
|
|
Username for the database to connect to.
|
||
|
|
|
driverClasspath: STRING
|
|
Java classpath used to get database drivers
|
||
|
|
|
envVars: MAP_STRING_STRING
|
|
Environment variables for container
|
||
|
|
|
isNoSQL: BOOLEAN
|
|
Set to true if the database is a NoSQL database
|
||
|
|
|
liquibaseConfigurationPath: STRING
|
|
Path to the liquibase configuration file.
|
||
|
|
|
liquibaseExtraArguments: STRING
|
|
Use to pass additional arguments to the liquibase command.
|
||
|
|
|
liquibaseLauncher: STRING = /usr/local/bin
|
|
Location of the Liquibase CLI path
|
||
|
|
|
stopStartRestartConnection:
CI<overthere.Host>
|
|
If set, the connection settings to use to connect to the target system to execute start, stop, restart etc. operations for the container.
|
||
|
|
|
tags: SET_OF_STRING
|
|
If set, only deployables with the same tag will be automatically mapped to this container.
|
| Hidden properties | ||
|---|---|---|
|
|
|
restartOrder: INTEGER = 90
|
|
The order of the restart container step in the step list.
|
||
|
|
|
restartWaitTime: INTEGER
|
|
The time to wait in seconds for a container restart action.
|
||
|
|
|
startOrder: INTEGER = 90
|
|
The order of the start container step in the step list.
|
||
|
|
|
startWaitTime: INTEGER
|
|
The time to wait in seconds for a container start action.
|
||
|
|
|
stopOrder: INTEGER = 10
|
|
The order of the stop container step in the step list.
|
||
|
|
|
stopWaitTime: INTEGER
|
|
The time to wait in seconds for a container stop action.
|
||
|
|
|
inspectClasspathResources: SET_OF_STRING
|
|
Additional classpath resources that should be uploaded to the working directory before executing the inspect script.
|
||
|
|
|
inspectScript: STRING
|
|
Classpath to the script used to inspect the generic container.
|
||
|
|
|
inspectTemplateClasspathResources: SET_OF_STRING
|
|
Additional template classpath resources that should be uploaded to the working directory before executing the inspect script.The template is first rendered and the rendered content copied to a file, with the same name as the template, in the working directory.
|
||
|
|
|
restartClasspathResources: SET_OF_STRING
|
|
Additional classpath resources that should be uploaded to the working directory before executing the restart script.
|
||
|
|
|
restartScript: STRING
|
|
Classpath to the script used to restart the generic container.
|
||
|
|
|
restartTemplateClasspathResources: SET_OF_STRING
|
|
Additional template classpath resources that should be uploaded to the working directory before executing the restart script.The template is first rendered and the rendered content copied to a file, with the same name as the template, in the working directory.
|
||
|
|
|
startClasspathResources: SET_OF_STRING
|
|
Additional classpath resources that should be uploaded to the working directory before executing the start script.
|
||
|
|
|
startScript: STRING
|
|
Classpath to the script used to start the generic container.
|
||
|
|
|
startTemplateClasspathResources: SET_OF_STRING
|
|
Additional template classpath resources that should be uploaded to the working directory before executing the start script.The template is first rendered and the rendered content copied to a file, with the same name as the template, in the working directory.
|
||
|
|
|
stopClasspathResources: SET_OF_STRING
|
|
Additional classpath resources that should be uploaded to the working directory before executing the stop script.
|
||
|
|
|
stopScript: STRING
|
|
Classpath to the script used to stop the generic container.
|
||
|
|
|
stopTemplateClasspathResources: SET_OF_STRING
|
|
Additional template classpath resources that should be uploaded to the working directory before executing the stop script.The template is first rendered and the rendered content copied to a file, with the same name as the template, in the working directory.
|
| Control task | Parameter CI | Attributes | Description |
|---|---|---|---|
| checkConnection |
delegate = jythonScript, script = liquibase/check_connection.py |
Verify the connection to the database from liquibase. |