ChangesetLabelCheck

This check enforces the Liquibase best-practice recommendation to assign labels to every changeset to provide better deployment control and to enhance traceability and granularity of deployments across changesets.

About ChangesetLabelCheck
Liquibase version required 4.5.0+
Scope (--checks-scope) changelog
Default status enabled
Default severity (exit code) 0 ("INFO")
Customizable settings No (static)

Uses

Use the check to enhance deployment control of specific changesets by requiring labels be assigned to every changeset in a changelog. Whether in automation or manual testing of proposed schema changes at the dev level, labels provide better deployment control. Using labels allows just the changesets which match specified label filter(s) to be run. For example, a team could label change sets by release, or branch name, or developer name, etc and when a Liquibase job is run, only the specified subset of label-matching changesets will be deployed. This policy check, like other checks, can be configured with a severity level which returns an exit code designed to stop automated jobs, giving your team time to apply this Liquibase best practice.

Note: Contexts and Labels are similar, but the best-practice is to use context for deployment environments and labels more like free-form tags for features, content, release, or other process-centric filter.

Use ChangesetLabelCheck

Prerequisites

  1. Ensure that you have correctly specified your Liquibase Pro license key.
  2. Ensure that the --checks-scope parameter includes the scope of this check.

For example:

--license-key=<string>
--checks-scope=<string>
globalArgs: { license-key: "<string>" }
cmdArgs: { checks-scope: "<string>" }
liquibase.licenseKey: <string>
liquibase.command.checksScope: <string>
liquibase.licenseKey: <string>
liquibase.command.checks.run.checksScope: <string>
JAVA_OPTS=-Dliquibase.licenseKey=<string> -Dliquibase.command.checksScope=<string>
JAVA_OPTS=-Dliquibase.licenseKey=<string> -Dliquibase.command.checks.run.checksScope=<string>
LIQUIBASE_LICENSE_KEY=<string>
LIQUIBASE_COMMAND_CHECKS_SCOPE=<string>
LIQUIBASE_LICENSE_KEY=<string>
LIQUIBASE_COMMAND_CHECKS_RUN_CHECKS_SCOPE=<string>

Enable

This check is enabled by default. To verify that it is currently enabled, run the show command:

liquibase checks show --check-name=<string>

Customize

This check is static, meaning it does not have any customization settings.

Run

To run the check, use the run command:

liquibase checks run --check-name=<string>
stages:
  Default:
    actions:
      - type: liquibase
        command: checks run
        cmdArgs: {check-name: <string>}

And then run the flow command on your flow file:

liquibase flow