Use the Python SDK to extend the XL Release plugin for XL Deploy
You can extend the functionality of the official XL Release plugin for XL Deploy by using xldeploy-py, the Python SDK for XL Deploy.
The SDK allows interaction with XL Deploy over the REST services and supports the following:
Each of the above services has specific methods that correspond to the REST services offered by XL Deploy.
Note: Not all methods and services available in the REST API are currently supported by the SDK. The SDK is customizable depending on the requirements of the clients using it.
In XL Release, you can create custom tasks. A custom task contains an XML section that becomes part of the
synthetic.xml in the
ext folder of the XL Release server, and a Python file stored to a location adjacent to
For more information, see How to Create Custom Task Types.
To extend the XL Release plugin for XL Deploy, you can create custom tasks that can retrieve items from XL Deploy or perform actions in XL Deploy using the SDK. These custom tasks can extend the
xldeploy.XldTask to reuse properties required for any task related to XL Deploy.
Create a custom task to check if a CI exists on the XL Deploy Server. The new type to be included in
synthetic.xml contains one new
scriptLocation parameter representing the location of the python script within the
The other parameters are inherited from
<type type="xld.CheckCIExist" extends="xldeploy.XldTask" label="XL-Deploy: Check CI exists" description="Custom Task to check if a CI exists"> <property name="scriptLocation" default="CheckExists.py" hidden="true"/> <property name="ci_path" category="input" label="CI Path" required="true"/> </type>
CheckExists.py Python script referred to in the sample XML above can perform the required actions using the Python SDK. The official plugin already contains methods to create the
xldeploy-py client. You must pass the
server property of the task as an argument to method
get_api_client(). The client returned can be used to call methods on any of the services mentioned above.
from xlrxldeploy import * client = get_api_client(task.getPythonScript().getProperty("server")) path="some/path/to/a/ci" print (client.repository.exists(path))