Create an export hook
You can use the export hook feature to configure Release to run a Jython script for every release that is about to be archived.
For example, you can use export hooks to store all completed releases in an SQL database and later use a reporting tool to query over the data. You can do this using the community supported XLR-SQL Export hook that can be found on GitHub.
This topic describes how to create an Export Hook from scratch.
Add a new synthetic type to
conf/synthetic.xml. For example:
<type type="acme.ElasticSearchExportHook" extends="xlrelease.ExportHook"> <property name="url" category="input" label="Elastic search server URL"/> </type>
url as a property of this synthetic type. This allows you to change the value in the user interface and use it in the Jython script. You can also add more properties, such as a username or password. For more information about synthetic types, see Create custom configuration types in Release.
The Jython script defines actions that you want to perform with release. The scope contains following variables:
exportHook: An object of type ExportHook
release: An object of type Release
releaseJson: A string with serialized release
logger: An object of type
org.slf4j.Logger; see Javadoc
Tip: It is recommended that you use
logger instead of
Store scripts in the
ext directory, which is a part of the classpath. By default, the export hook tries to locate
prefix/TypeName.py on the classpath. In the case of this example, it will be
Alternatively, you can set a customized script path in the
scriptLocation property of each export hook:
<type type="acme.ElasticSearchExportHook" extends="xlrelease.ExportHook"> <property name="url" category="input" label="Elastic search server URL"/> <property name="scriptLocation" hidden="true" default="mypath/MyScript.py" /> </type>
It is recommended that you use the default location of
In Release, from the navigation pane, go to Configuration> Connections and configure an instance of your export hook.
All export hooks are executed for all completed releases just before they are archived. The order of execution is not guaranteed.
Each export hook has only one attempt to perform actions on the release. If it fails, it is not retried.
To learn more about export hooks, download the sample export hook from GitHub and customize it as desired.