Define a rule
Deploy rules allow you to use XML or Jython to specify the steps that belong in a deployment plan and how the steps are configured.
You define and disable rules in XL_DEPLOY_SERVER_HOME/ext/xl-rules.xml
. Deploy plugin JAR files can also contain xl-rules.xml
files.
The xl-rules.xml
file has the default namespace xmlns="http://www.xebialabs.com/deployit/xl-rules"
. The root element must be rules
, under which rule
and disable-rule
elements are located.
Each rule:
- Must have a name that is unique across the whole system
- Must have a scope
- Must define the conditions under which it will run
- Can use the planning context to influence the resulting plan
Scanning for rules
When the Deploy server starts, it scans all xl-rules.xml
files and registers their rules.
You can configure Deploy to rescan all rules on the server whenever you change the XL_DEPLOY_SERVER_HOME/ext/xl-rules.xml
file. To do this, edit the file-watch
setting in the XL_DEPLOY_SERVER_HOME/conf/planner.conf
file. For example, to check every 5 seconds if xl-rules.xml
has been modified:
xl {
file-watch {
interval = 5 seconds
}
}
Note: As of Deploy version 8.6, the planner.conf
file was deprecated. The configuration properties from this file have been migrated to the xl
block of the xl-deploy.conf
file. For more information, see Deploy configuration files.
By default, the interval is set to 0 seconds. This means that Deploy will not automatically rescan the rules when XL_DEPLOY_SERVER_HOME/ext/xl-rules.xml
changes.
If Deploy is configured to automatically rescan the rules and it finds that xl-rules.xml
has been modified, it will rescan all rules in the system. By automatically reloading the rules, you can easily experiment until you are satisfied with your set of rules.
Note: If you modify planner.conf
, you must restart the Deploy server.