Skip to main content
DevOps icon showing cogs

This post is from the XebiaLabs blog and has not been updated since the original publish date.

Last Updated Apr 19, 2015 — DevOps Expert

Adding Rules To XL-Deploy


XL-Deploy uses it's object model to determine it's deployment plan.  For most applications this works fine.  Sometimes we might want to take some extra steps during a deployment.  Custom deployment steps can be created by defining these rules in the XL-Rules file.  Sometimes we may want to dynamically create deployment steps depending on other information in the environment.  As an example of this I will demonstrate how to dynamically create deployment steps with XL-Rules and a small Jython script.   For this example lets say we need to run a script at the beginning and end of our deployment.  We only need to run this script if the infrastructure host has the "pretest" or "posttest" tags set.  Furthermore, we only need to run the script once on each host.  The first step is to define a rule in xl-rules.xmlScreen Shot 2015-03-09 at 4.36.47 PMThe <planning-script-path> tag defines the location of a Jython script that will dynamically create the deployment steps that should be added to the deployment plan.  The path the script starts from is the <XLDeploy_HOME>/ext folder.  Once this file is changed it is necessary to restart the XL-Deploy server for this change to take effect.   Out next step is do define the logic that determines when to add steps to the deployment plan.Screen Shot 2015-03-23 at 4.22.36 PMI have defined the functions to help build our additional deployment steps.  So our script defines the methods then calls update_hosts().  We pass a call to the getContainerListFromDeployedApplicaiton() method to get the unique list of containers we are deploying to.  Then we can go through all of the containers checking for our tags.  If we find the tag set we will add either the pretest step or the posttest step.  For this example our script is the same for both.  The script in this example is a Free Marker Template script.  The result of this script adds some pre deploy steps as well as some post install steps as follows:Screen Shot 2015-04-17 at 1.41.57 PMIt is convenient to use this method for specialized load balancers or kicking off scripted testing from XL Deploy.  You might even find other uses for this. The code in this example can be found in my blog github repository as follows:


More from the Blog

View more
Ascension Launch Banner
Apr 26, 2022

Get ready for peak performance with’s newest AI-Powered DevOps Platform Ascension Release

Today, is excited to announce our latest AI-Powered DevOps ...
Read More
Jan 24, 2022 Value Stream Delivery for SAFe®: The key to amazing business outcomes

The Scaled Agile Framework (SAFe) is the world’s leading framework for ...
Read More
Dec 09, 2021

How SaaS and cloud-based solutions helped the U.S. Department of Veterans Affairs achieve digital transformation

Modernizing legacy systems was an ongoing goal for the U.S. Department ...
Read More
Nov 29, 2021

Increase velocity and reduce risk with AI and machine learning

Artificial Intelligence (AI) and machine learning (ML) have proven use ...
Read More
Contact Us