- Docs Home
- Getting started
- XL Release
- Overview
- Installation
- Get started with XL Release
- Manage your installation
- Model your releases
- Release your software
- Release overview
- Create and start releases
- Configure release properties
- Schedule releases
- Start a release from an archived release
- Start a release from a template
- Start a release from another release
- Create a release from a Git repository
- Add a phase to a release or template
- Add a task to a phase in a release or template
- Import a release template
- Trigger releases
- Work with running releases
- Work with plugins
- Using reports
- Customize XL Release
- API and scripting overview
- Create custom task types
- Create custom configuration types
- Create custom trigger types
- Extend the XL Release GUI
- Declare custom REST endpoints
- Create custom tiles
- Create custom task types
- Create custom configuration types
- Using scheduling in scripts to connect to long running jobs
- Implement a custom failure handler
- Listen to XL Release events
- Configuration settings
- Release manuals
- XL Deploy
- Overview
- Installation
- Get started with XL Deploy
- Manage your installation
- Logging
- Start XL Deploy
- Shut down XL Deploy
- Back up XL Deploy
- Upgrade XL Deploy
- The XL Deploy repository
- Configure the repository
- Configure XL Deploy to fetch artifacts from a Maven repository
- Manage security
- Manage system settings
- XL Deploy configuration files
- Configure failover for XL Deploy
- High availability with master-worker setup
- Add, start, and use workers
- Configure active/hot-standby mode
- Configure the task execution engine
- Troubleshoot the Jackrabbit JCR repository
- Configure XL Deploy client settings
- Enable XL Deploy maintenance mode
- Update the XL Deploy digital certificate
- The XL Deploy work directory
- Reclaim disk space on an XL Deploy server
- Hide internal XL Deploy server errors
- Automatically purge packages according to a user-defined policy
- Automatically purge the task archive according to a user-defined policy
- Specify file encoding on the XL Deploy server
- Automatically archive tasks according to a user-defined policy
- Best practices for maintaining XebiaLabs tools
- Connect to your infrastructure
- Set up applications and environments
- Prepare your application for XL Deploy
- Create a deployment package
- Define application dependencies
- Configure an environment
- Using placeholders and dictionaries
- Working with deployment packages
- Preparing your application for XL Deploy
- Understanding deployables and deployeds
- XL Deploy manifest format
- Deprecated XL Deploy manifest format
- Using the XL Deploy Manifest Editor
- Understanding archives and folders in XL Deploy
- Add an externally stored artifact to a package
- Extend the external artifact storage feature
- Add a package to XL Deploy
- Export a deployment package
- XL Deploy for developers
- Tips and tricks for deployment packages
- Deploy an application
- Deployment overview
- Understanding the XL Deploy planning phase
- Steps and step lists in XL Deploy
- Understanding tasks in XL Deploy
- Deploy an application
- Use tags to configure deployments
- Preview the deployment plan
- Use orchestration
- Working with deployments
- Stopping, aborting, or canceling a deployment
- Schedule a deployment
- Update a deployed application
- Staging artifacts in XL Deploy
- Monitor and reassign deployment tasks
- Make previously deployed property values available in a PowerShell script
- Undeploy an application or deprovision an environment
- Perform canary deployments
- Perform dark launch deployments
- Perform hot deployments
- Deploying an externally stored artifact using the XL Deploy CLI
- Schedule or reschedule a task
- Using the deployment pipeline view
- Deploy to remote datacenters
- Get started with provisioning
- Introduction to the release dashboard
- Work with the CLI
- Work with plugins
- Create an XL Deploy plugin
- Base plugins and the deployed object
- Implement custom XL Deploy plugpoints
- Add a checkpoint to a custom plugin
- Step options for the Generic, PowerShell, and Python plugins
- Sample Java-based XL Deploy plugin
- XL Deploy plugin tutorial
- Standard plugins
- Middleware plugins
- Apache Tomcat
- BizTalk
- F5 BIG-IP
- GlassFish
- IBM WebSphere Application Server
- IBM WebSphere Process Server
- IBM WebSphere Liberty Profile Server
- IBM WebSphere MQ
- JBoss Application Server 5 and 6
- JBoss Application Server 7 and up
- Microsoft Internet Information Services
- Microsoft Windows
- NetScaler
- Oracle Service Bus
- Oracle Service-Oriented Architecture
- Oracle WebLogic Application Server
- Provisioning plugins
- Container platform plugins
- Tools
- Community plugins
- Using control tasks
- Using the explorer
- Using XL Deploy reports
- Customize XL Deploy
- Release manuals
- DevOps as Code
- Get started with DevOps as Code
- Install the XL CLI
- XL CLI command reference
- Work with the YAML format
- YAML snippets reference
- Manage values in DevOps as Code
- Track progress using XL CLI output
- Manage risk profiles
- Manage XL Deploy permissions in YAML
- Manage XL Release permissions in YAML
- Manage XL Release folder permissions in YAML
- Tutorial: Managing an XL Release template as code
- Blueprints
- API and CI references
- Plugins
- XL Release plugins
- XL Deploy plugins
- Standard plugins
- Middleware plugins
- Apache Tomcat
- BizTalk
- F5 BIG-IP
- GlassFish
- IBM WebSphere Application Server
- IBM WebSphere Process Server
- IBM WebSphere Liberty Profile Server
- IBM WebSphere MQ
- JBoss Application Server 5 and 6
- JBoss Application Server 7 and up
- Microsoft Internet Information Services
- Microsoft Windows
- NetScaler
- Oracle Service Bus
- Oracle Service-Oriented Architecture
- Oracle WebLogic Application Server
- Provisioning plugins
- Container platform plugins
- Tools
- Community plugins
- Videos
- Community
- Fix Trackers
- Archive
Valid since:
XL Release 8.1.0
Task failure handler
As of XL Release 8.1.0 a new property was added on the task level called Handling failure. This means that you can enable failure handling on any task in a phase. You can use this to execute a Jython
script when the task fails its execution or just to skip the task.
-
Skip task: If the task fails, it is automatically skipped.
-
Define additional action: This option allows you to write your own Jython script to be executed if the task is going to fail. You can also use a script to do a clean up, retry, or conditionally skip or fail a task.
Scripts
Important: Modification of a task status, such as: skip task, retry task, or other outcomes, must be the last line of your script.
If you do not modify the task status in your script, the task will be in the failed state after the script has run.
The script will run until it finishes or until the timeout is reached. You can modify the duration of the timeout in conf/xl-release.conf
by changing this property:
xl.timeouts.failureHandlerTimeout=60 seconds
If the handler script produces an error or a time out occurs, the task will be marked as failed.
While the failure handler script is running, you can manually abort the task by clicking on the right of the task, and selecting Abort.
Script examples
These are some examples of how you can use the Handling failures feature.
Retry a task a number of times
If your release process contains a third party dependency that is error prone and the task must be retried before you can conclude if something is broken:
- Create a release variable of type
Number
, namedattempt
, and set the default value to0
. - Set the operation to Define additional action.
- Set the following script:
if (releaseVariables['attempt'] < 3):
releaseVariables['attempt'] = releaseVariables['attempt'] + 1
taskApi.retryTask(getCurrentTask().getId(), "Retrying task from failure handler.")
else:
taskApi.skipTask(getCurrentTask().getId(), "Skipped task from failure handler.")
Set a variable to be used on a precondition
Depending on the status of a tasks, you can execute or skip the subsequent task or group of tasks by setting the value of a variable and using it in a precondition:
- Create an
executeTask
variable of typeBoolean
with the default value set toTrue
(click on checkbox). - Set the operation to Define additional action.
- Configure the script:
-
If the first task fails and you want to skip the subsequent task, set the following script:
releaseVariables['executeTask'] = False
-
If the first task fails and you want to execute the subsequent task, set the following script:
releaseVariables['executeTask'] = True
-
- Set the precondition on a task or task group:
${executeTask}
.
Skip a phase in advance
You can skip a complete phase if an error occurred in previous phases:
- Set the operation to Define additional action.
- Set the following script:
thisTask = getCurrentTask()
nextPhase = phaseApi.searchPhasesByTitle("next phase", getCurrentRelease().id)[0]
for t in nextPhase.tasks:
taskApi.skipTask(t.id, "Skipped from failure handler.")
taskApi.skipTask(thisTask.id, "Skipped task from failure handler.")
Disabling the feature
If you want to disable this feature for a specific type of task, add the following line to the conf/deployit-defaults.properties
file:
xlrelease.GateTask.failureHandlerEnabled=false
This snippet sample disables Handling failures for the Gate Task
.
To disable this feature for all task types, add the following line to conf/deployit-defaults.properties
file:
xlrelease.Task.failureHandlerEnabled=false
This snippet sample disables Handling failures for all task types.
Important: The code provided in this topic is sample code that is not officially supported by XebiaLabs. If you have questions, please contact the XebiaLabs support team.