Skip to main content
Version: Deploy 24.3

Define a Rule

This topic provides information about Deploy rules, which allow you to use XML or Jython to specify the steps included in a deployment plan and how these 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 the xl-rules.xml file and registers the 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, update the file-watch key in the XL_DEPLOY_SERVER_HOME/centralConfiguration/deploy-task.yaml file.

For example, to poll every 1 second if the xl-rules.xml file has been modified:

deploy:
task:
...
...
planner:
file-watch:
interval: 1 second
...
...
note

As of Deploy version 8.6, the planner.conf file is deprecated. The configuration properties from this file have been migrated to deploy.task.planner block in the deploy-task.yaml 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 the deploy-task.yaml file, you must restart the Deploy server.