Create a check chain
Check Chains allow users to link multiple checks together and act as one Policy Check.
Procedure
Copy the chained check template.
To chain checks together with conditional logic, you must clone and modify the ChainedChecksTemplate
check:
liquibase checks copy --check-name=ChainedChecksTemplate
Customize your check chain copy by giving it a short name.
In this example we will call it TableLabelChain
Set the severity of the check chain.
Enter 0
, 1
, 2
, 3
, or 4
.
Specify the specific checks to link in this chained check
the logic conditionals, and optional groupings between these checks.
Example 1: If you want two checks to both trigger for TableLableChain
to trigger, link them as checkname1 && checkname2
Example 2: If you need EITHER two checks to trigger, or one separate check for TableLabelChain
to trigger, you would link them as
“(checkname1 && checkname2) || checkname3
”
Note: Set the logic condition using
!
,&&
, or||
operators. The order of operations from highest to lowest precedence is NOT → AND → OR respectively. Grouping with parenthesis allows for enhanced trigger conditions for Check Chains.
Set the logical conditional
In this TableLabelChain
example, the goal is for both checks to trigger for TableLabelChain. For this to occur, set TableColumnLimit3 && ChangesetLabelCheck
as the logical conditional.
Note: When a check chain is created, the linked checks are automatically enabled if they are disabled, and the chain is ready to run. A singular check within the chain can be disabled, and when the chain is run, a message will alert the user to this.
The Check Chains severity setting overrides any individual checks' severity setting. If ChangesetLabelCheck
is set to severity 2, but a chained check that includes ChangesetLabelCheck
is set to severity 4, then the severity will be set to 4 when the chained check runs.
Optional: Keep the default CLI success message
If you would like to keep the default CLI success message, simply press the Enter key to finish customizing your check chain.
The default message is:
The conditions in '<Check Chains shortname>' were met for '<logic conditional>'. The Check Chains include <checknames>.
Optional: If you would like the CLI success message to be different than the default
Set the message you want to appear when the check chain is successful, and press Enter.
Ensure the checks are enabled
Run the checks show command
liquibase checks show