Skip to content

Commit

Permalink
PD-4822: Quality checks template
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-velonis1 committed Jul 25, 2024
1 parent 3f402e3 commit f26f0d8
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 38 deletions.
40 changes: 40 additions & 0 deletions Content/Z_Resources/Snippets/text/checks-prerequisites.flsnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd">
<body>
<h2>Prerequisites</h2>
<ol>
<li>Ensure that you have correctly specified your <a href="../../../workflows/liquibase-pro/how-to-apply-your-liquibase-pro-license-key.htm"><MadCap:variable name="General.LBPro" /> license key</a>.</li>
<li>Ensure that the <code class="language-text">--checks-scope</code> parameter includes the scope of this check.</li>
</ol>
<p>For example:</p>
<div class="js-tabs">
<ul class="js-tablist" data-hx="h3">
<li class="js-tablist__item"><a href="#cli_example_prereq" id="label_cli_example_prereq" class="js-tablist__link">CLI</a>
</li>
<li class="js-tablist__item"><a href="#flow_example_prereq" id="label_flow_example_prereq" class="js-tablist__link">Flow</a>
</li>
<li class="js-tablist__item"><a href="#properties_file_example_prereq" id="label_properties_file_example_prereq" class="js-tablist__link"><code>liquibase.properties</code></a>
</li>
<li class="js-tablist__item"><a href="#java_opts_example_prereq" id="label_java_opts_example_prereq" class="js-tablist__link"><code>JAVA_OPTS</code></a>
</li>
<li class="js-tablist__item"><a href="#envar_example_prereq" id="label_envar_example_prereq" class="js-tablist__link">Environment variable</a>
</li>
</ul>
<div id="cli_example_prereq" class="js-tabcontent"><pre xml:space="preserve"><code class="language-text">--license-key=&lt;string&gt;</code></pre><pre xml:space="preserve"><code class="language-text">--checks-scope=&lt;string&gt;</code></pre>
</div>
<div id="flow_example_prereq" class="js-tabcontent"><pre xml:space="preserve"><code class="language-text">globalArgs: { license-key: "&lt;string&gt;" }
cmdArgs: { checks-scope: "&lt;string&gt;" }</code></pre>
</div>
<div id="properties_file_example_prereq" class="js-tabcontent"><pre xml:space="preserve"><code class="language-text">liquibase.licenseKey: &lt;string&gt;
liquibase.command.checksScope: &lt;string&gt;</code></pre><pre xml:space="preserve"><code class="language-text">liquibase.licenseKey: &lt;string&gt;
liquibase.command.checks.run.checksScope: &lt;string&gt;</code></pre>
</div>
<div id="java_opts_example_prereq" class="js-tabcontent"><pre xml:space="preserve"><code class="language-text">JAVA_OPTS=-Dliquibase.licenseKey=&lt;string&gt; -Dliquibase.command.checksScope=&lt;string&gt;</code></pre><pre xml:space="preserve"><code class="language-text">JAVA_OPTS=-Dliquibase.licenseKey=&lt;string&gt; -Dliquibase.command.checks.run.checksScope=&lt;string&gt;</code></pre>
</div>
<div id="envar_example_prereq" class="js-tabcontent"><pre xml:space="preserve"><code class="language-text">LIQUIBASE_LICENSE_KEY=&lt;string&gt;
LIQUIBASE_COMMAND_CHECKS_SCOPE=&lt;string&gt;</code></pre><pre xml:space="preserve"><code class="language-text">LIQUIBASE_LICENSE_KEY=&lt;string&gt;
LIQUIBASE_COMMAND_CHECKS_RUN_CHECKS_SCOPE=&lt;string&gt;</code></pre>
</div>
</div>
</body>
</html>
38 changes: 38 additions & 0 deletions Content/Z_Resources/Snippets/text/checks-use.flsnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd">
<head>
</head>
<body>
<h3>Enable</h3>
<p MadCap:conditions="checks-use.default-enabled">This check is enabled by default. To verify that it is currently enabled, run the <code><MadCap:xref href="../../../commands/quality-checks/subcommands/show.htm">show</MadCap:xref></code> command:</p><pre xml:space="preserve" MadCap:conditions="checks-use.default-enabled"><code class="language-text">liquibase checks show --check-name=&lt;string&gt;</code></pre>
<p MadCap:conditions="checks-use.default-disabled">This check is disabled by default. To enable it, run the <code><MadCap:xref href="../../../commands/quality-checks/subcommands/enable.htm">enable</MadCap:xref></code> command:</p><pre xml:space="preserve" MadCap:conditions="checks-use.default-disabled"><code class="language-text">liquibase checks enable --check-name=&lt;string&gt;</code></pre>
<p MadCap:conditions="checks-use.must-copy">When you try to enable the check, <MadCap:variable name="General.Liquibase" /> displays the following message:</p><pre xml:space="preserve" MadCap:conditions="checks-use.must-copy"><code class="language-text">This check can not be enabled directly because one or more fields does not have a default value. Create a copy of this check and initiate the customization workflow.</code></pre>
<h3>Customize</h3>
<p MadCap:conditions="checks-use.settings-static">This check is static, meaning it does not have any customization settings.</p>
<p MadCap:conditions="checks-use.settings-dynamic">This check is dynamic, meaning you can customize its settings.</p>
<p MadCap:conditions="checks-use.must-copy">However, you cannot directly customize this check. Instead, you must use the <code><MadCap:xref href="../../../commands/quality-checks/subcommands/copy.htm">copy</MadCap:xref></code> command to create a copy of the check which you can then customize:</p><pre xml:space="preserve" MadCap:conditions="checks-use.must-copy"><code class="language-text">liquibase checks copy --check-name=&lt;string&gt;</code></pre>
<p MadCap:conditions="checks-use.must-copy">Follow the steps in the CLI to give your new check a useful name. By default, the name of the copy is <code>&lt;CheckName&gt;1</code>.</p>
<p MadCap:conditions="checks-use.settings-dynamic">Run the <code><MadCap:xref href="../../../commands/quality-checks/subcommands/customize.htm">customize</MadCap:xref></code> command:</p><pre xml:space="preserve" MadCap:conditions="checks-use.settings-dynamic"><code class="language-text">liquibase checks customize --check-name=&lt;string&gt;</code></pre>
<p MadCap:conditions="checks-use.settings-dynamic">Follow the steps in the CLI to set new values. When finished, you can run the show command again to verify that your configuration is correct:</p><pre xml:space="preserve" MadCap:conditions="checks-use.settings-dynamic"><code class="language-text">liquibase checks show --check-name=&lt;string&gt;</code></pre>
<h3>Run</h3>
<p>To run the check, use the <code><MadCap:xref href="../../../commands/quality-checks/subcommands/run.htm">run</MadCap:xref></code> command:</p>
<div class="js-tabs">
<ul class="js-tablist" data-hx="h3">
<li class="js-tablist__item"><a href="#cli_example_use" id="label_cli_example_use" class="js-tablist__link">CLI example</a>
</li>
<li class="js-tablist__item"><a href="#flow_example_use" id="label_flow_example_use" class="js-tablist__link">Flow example</a>
</li>
</ul>
<div id="cli_example_use" class="js-tabcontent"><pre xml:space="preserve"><code class="language-cli">liquibase checks run --check-name=&lt;string&gt;</code></pre>
</div>
<div id="flow_example_use" class="js-tabcontent"><pre xml:space="preserve"><code class="language-yaml">stages:
Default:
actions:
- type: liquibase
command: checks run
cmdArgs: {check-name: &lt;string&gt;}</code></pre>
<p>And then run the <code>flow</code> command on your flow file:</p><pre xml:space="preserve"><code class="language-text">liquibase flow</code></pre>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,50 @@
</head>
<body>
<MadCap:snippetBlock src="../../../../Z_Resources/Snippets/images/icon-pro-top.flsnp" />
<h1>ChangeDropColumnWarn</h1>
<p>This check warns a user when a column is being dropped so that they can ensure that such a schema change won't lead to unintentional loss of data and unrecoverable data loss.</p>
<h2>Uses</h2>
<p>Use the check to warn when a column is being dropped. A column drop can lead to a significant schema change which can destroy your organization’s most essential resource: critical data. Such an unintended change can result in permanent data loss, production level service outages, and more. This quality 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 inspect these significant changes.</p>
<h2>Run the ChangeDropColumnWarn check</h2>
<p>The <code class="language-text">ChangeDropColumnWarn</code> check is enabled by default, so you will not need to turn it on if you have not changed your settings previously. To run the <code class="language-text">ChangeDropColumnWarn</code> check, ensure you have a <MadCap:variable name="General.LBPro" /> license and the <code class="language-text">checks-scope</code> property includes <code class="language-text"><MadCap:variable name="General.changelog" /></code>. The <MadCap:xref href="../../command-arguments/checks-scope.htm">checks-scope</MadCap:xref> parameter is set in the default properties file, environment variable, or any standard method. Then, check the changelog to see if <code class="language-text">ChangeDropColumnWarn</code> is enabled. </p>
<p>Enable the <code class="language-text">ChangeDropColumnWarn</code> check by running the following command in the CLI:</p><pre><code class="language-text">liquibase checks enable --check-name=ChangeDropColumnWarn</code></pre>
<h1><code>ChangeDropColumnWarn</code>
</h1>
<p><code class="language-text">ChangeDropColumnWarn</code> is a quality check that warns a user when a column is being dropped so that they can ensure that such a schema change won't lead to unintentional loss of data and unrecoverable data loss.</p>
<table>
<col style="width: auto;" />
<col style="width: auto;" />
<col style="width: auto;" />
<col style="width: auto;" />
<col style="width: auto;" />
<col style="width: auto;" />
<thead>
<col />
<col />
<tbody>
<tr>
<th>Short Name</th>
<th>Scope</th>
<th>Enabled</th>
<th>Severity</th>
<th>Customization</th>
<th>Description</th>
<th colspan="2">About <code class="language-text">ChangeDropColumnWarn</code></th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="language-text">ChangeDropColumnWarn</code>
</td>
<td><MadCap:variable name="General.changelog" />
</td>
<td>
<p>true</p>
</td>
<td>
<p>Default value: 0</p>
<MadCap:snippetBlock src="../../../../Z_Resources/Snippets/def/attributes/cli/quality-checks/cli-checks-severity-customization.flsnp" />
<td style="font-weight: bold;"><MadCap:variable name="General.Liquibase" /> version required</td>
<td>4.5.0+</td>
</tr>
<tr>
<td style="font-weight: bold;">Scope (<code class="language-text">--checks-scope</code>)</td>
<td><code class="language-text">changelog</code>
</td>
<td>
<p>&lt;None&gt;</p>
</tr>
<tr>
<td style="font-weight: bold;">Default status</td>
<td><code class="language-text">enabled</code>
</td>
<td>This check warns a user when a column is being dropped so that they can ensure that dropping the table won't lead to unintentional loss of data</td>
</tr>
<tr>
<td style="font-weight: bold;">Default severity (exit code)</td>
<td><code class="language-text">0</code> ("<code class="language-text">INFO</code>")</td>
</tr>
<tr>
<td style="font-weight: bold;">Customizable settings</td>
<td>No (static)</td>
</tr>
</tbody>
</table>
<h2>Uses</h2>
<p>Use the check to warn when a column is being dropped. A column drop can lead to a significant schema change which can destroy your organization’s most essential resource: critical data. Such an unintended change can result in permanent data loss, production level service outages, and more. This quality 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 inspect these significant changes.</p>
<MadCap:snippetBlock src="../../../../Z_Resources/Snippets/text/checks-prerequisites.flsnp" />
<h2>Use <code class="language-text">ChangeDropColumnWarn</code></h2>
<MadCap:snippetBlock src="../../../../Z_Resources/Snippets/text/checks-use.flsnp" MadCap:conditionTagExpression="include[checks-use.default-enabled or checks-use.settings-static]" />
<MadCap:dropDown>
<MadCap:dropDownHead>
<MadCap:dropDownHotspot><code class="language-text">liquibase checks enable --check-name=ChangeDropColumnWarn</code> example output</MadCap:dropDownHotspot>
</MadCap:dropDownHead>
<MadCap:dropDownBody><pre xml:space="preserve"><code class="language-text">
Check 'ChangeDropColumnWarn' has been enabled.
<MadCap:dropDownBody><pre xml:space="preserve"><code class="language-text">Check 'ChangeDropColumnWarn' has been enabled.
+-----+--------------------------------+----------------------------+--------------------------------+---------+--------------------------------+----------+------------+
| # | Check Name | Short Name | Description | Enabled | Customization | Severity | Scope |
+-----+--------------------------------+----------------------------+--------------------------------+---------+--------------------------------+----------+------------+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<body>
<h1><MadCap:variable name="General.Liquibase" /> 4.5.0 Release Notes</h1>
<p><b>Full Changelog:</b>&#160;<a href="https://github.com/liquibase/liquibase/compare/v4.4.3...v4.5.0">v4.4.3...v4.5.0</a> (September 27, 2021)</p>
<p>This release includes community-contributed pull requests, <MadCap:variable name="General.LBCommunity" /> and <MadCap:variable name="General.LBPro" /> bug fixes, and support for .</p>
<p>This release includes community-contributed pull requests, <MadCap:variable name="General.LBCommunity" /> and <MadCap:variable name="General.LBPro" /> bug fixes, and support for <MadCap:xref href="../../../commands/quality-checks/home.htm">Quality Checks</MadCap:xref>.</p>
<p>Quality checks allow you to run checks against SQL, XML, JSON, and YAML <MadCap:variable name="General.changelog" />s for conditions and configurations important to your organization. More quality checks are forthcoming in future releases; provide feedback on what checks matter most to you.</p>
<p>Here is a closer look at what we improved in the latest release.</p>
<h3>Notable Changes</h3>
Expand Down
28 changes: 28 additions & 0 deletions Project/ConditionTagSets/checks-use.flcts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<CatapultConditionTagSet>
<ConditionTag
Comment="Customization available"
Name="settings-dynamic"
BackgroundColor="#ff00fb"
OriginalName="settings-dynamic" />
<ConditionTag
Comment="Check is disabled by default"
Name="default-disabled"
BackgroundColor="#00ffff"
OriginalName="default-disabled" />
<ConditionTag
BackgroundColor="#a607c8"
Name="settings-static"
Comment="Customization not available"
OriginalName="settings-static" />
<ConditionTag
BackgroundColor="#ffa500"
Name="must-copy"
Comment="Must copy in order to customize"
OriginalName="must-copy" />
<ConditionTag
BackgroundColor="#7cfc00"
Name="default-enabled"
Comment="Check is enabled by default"
OriginalName="default-enabled" />
</CatapultConditionTagSet>

0 comments on commit f26f0d8

Please sign in to comment.