Recently we had a question from a user who wanted to be able to import and export all of his XL Release templates at the same time. Fortunately we were able to provide them with this small collection of scripts to do just that. The source code is on the XebiaLabs community Gists site.
This project consists of three scripts as follows:
- getTemplateIds.sh
- bulkExportTemplates.sh
- bulkImportTemplates.sh
Let's see what each utility does. Before we import or export any templates from
XL Release we need to get a list of Template IDs in the system. The
getTemplateId.sh script will export a list of templates and put them in a file
templatesToExport.txt in the same directory.
getTemplateId.sh takes several command line options, as follows:
- --user: The XL Release user name. (default = admin)
- --password: The XL Release users password (default = admin)
- --hostname: The host that XL Release is running on (default = localhost)
- --port: The port XL Release is listening on. (default = 5516)
- --protocol: The protocol XL Release is using (http/httops). (defualt = http)
Once
getTemplateId.sh is run, all of the XL Release templates will be listed in the
templatesToExport.txt file. At this point you can execute
bulkExportTemplates.sh to export all of the templates from the XL Release server to an
export directory under the current directory. The command line options for the
bulkExportTemplates.sh script are the same as the
getTemplateIds.sh script.
With a group of templates exported from
XL Release, they can now be imported into an XL Release instance using the the
bulkImportTemplates.sh script. The
bulkImportTemplates.sh script takes the same command line parameters as the
getTemplateId.sh script above. If you try to import a copy of an existing XL Release template, XL Release will create a "copy" of the template so even if you type to import a template of the same name you will not lose either one.
The scripts can be found at
xlr-template-import-export-util in the
XebiaLabs community Gists site.
Important: The code here is sample code only that is not officially supported by XebiaLabs. If you have questions, please
contact our support team.