ChangesetContextCheck

Last updated: July 14, 2025

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

Uses

Property

Value

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 one or more contexts be assigned to every changeset in a changelog. Whether in automation or manual testing of proposed schema changes at the dev level, contexts provide better deployment control. Using contexts allows just the changesets that match the specified contexts filter(s) to be run. For example, a team could provide contexts to change sets by "dev," "staging," "prod," or all three "dev, staging, prod," and when a Liquibase job is run, only the specified subset of context-matching changesets will be deployed. This policy check, like other checks, can be configured with a "severity" level that 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.

Before you begin

  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.

Changelog checks prerequisites

--license-key=<string>
--checks-scope=<string>

Procedure

1

Enable

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

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

2

To run the check, use the checks run command.

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

Note: For flow files you'll need to run liquibase flow to apply your changes.

ChangesetContextCheck - Liquibase