Well Formatted E-Mail Notifications In XL Deploy
As a part of your XL Deploy automation strategy, you might want to have XL Deploy send out emails during some state changes of the deployment process. XL Deploy uses FreeMarker templates to format and deliver emails when triggered in the deployment process. XL Deploy can provide emails to various groups in your organization. The emails sent out can be customized to different audiences in your organization as well. In this article I will show you how to configure XL Deploy to send out emails during the deployment process. For each deployment we want to collect some additional information that we are going to put in these emails. To do that we need to make some changes to the synthetic.xml file as follows:We can also use some of this information to determine if a deployment can continue in its' pipeline. Once the changes are made to the synthetic.xml file, restart the XL Deploy server. We will need to tell XL Deploy where there is an SMTP server that emails can be set to. In my environment (linux) I can create my own SMTP server and configure it as follows:We can call the mail server "DefaultSmtpServer". Now we will need to create a template for the email that will be sent out. Under Configuration you can create folders for organization as you like, but then we will create a trigger.EmailNotification as follows:We don't need to change the "From Address" as that will be picked up from the mail.SmtpServer. We see a little bit of the FreeMarker templating in the subject line of the email. For now notice that I selected that we should send the content of our emails as HTML. I'll talk more about this later. Emails are sent out on a triggered event. In order to set up a task trigger, we will need to carefully select the state transitions so our trigger will fire when we need it to. The transitions we will connect emails to today are as follows:
- For Deployment Failure: States should be from EXECUTING to STOPPED.
- For Deployment Complete: States should be from ANY to EXCUTED
- https://support.xebialabs.com/entries/27030538-Configuring-email-notifications-with-XL Deploy
- https://docs.xebialabs.com/generated/XL Deploy/4.5.x/rest-api/com.xebialabs.XL Deploy.engine.api.execution.StepState.html
- http://docs.xebialabs.com/releases/latest/XL Deploy/triggerPluginManual.html#task-state-transitions
- http://docs.xebialabs.com/releases/latest/XL Deploy/triggerPluginManual.html#triggertasktrigger