Welcome!

XebiaLabs | Continuous Delivery and Agile DevOps Tools

XebiaLabs Blog

Subscribe to XebiaLabs Blog: eMailAlertsEmail Alerts
Get XebiaLabs Blog via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: Intel XML, XML Magazine

Blog Feed Post

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.xml

Screen Shot 2015-03-09 at 4.36.47 PM

The <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 PM

I 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 PM

It 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:

 

 

The post Adding Rules To XL-Deploy appeared first on XebiaLabs.

Read the original blog entry...

More Stories By XebiaLabs Blog

XebiaLabs is the technology leader for automation software for DevOps and Continuous Delivery. It focuses on helping companies accelerate the delivery of new software in the most efficient manner. Its products are simple to use, quick to implement, and provide robust enterprise technology.