Automatically Unzip deployed Zip file

Follow

Ibrahim AbouElyazed -

Issue

In some cases when you deploy a zip file you will need to unzip it automatically, this requires some customization to create new type that support doing this.

Environment

XLDeploy

Resolution

You can use any of below options,

 1. Package the content of the zip as a folder file.Folder type and when deployment done it will be unzipped on target system but this works only for .zip files not other archived extensions such as .tar

 2. You have is to Extend the functionality of XLDeploy by creating you own custom type, you can find more details about this in this link, below is an example of how you can do this.
Add the following type to XL_Deploy_Server_Home/ext/synthetic.xml

<type type="arch.DeployedZip" extends="generic.ExecutedScriptWithDerivedArtifact" deployable-type="arch.Zip"
container-type="overthere.Host">
<generate-deployable type="arch.Zip" extends="generic.File"/>
<property name="targetPath"/>
<property name="createScript" default="unzip_scripts/install-zip" hidden="true"/>
<property name="destroyScript" default="unzip_scripts/uninstall-zip" hidden="true"/>
</type>

Then create directory named unzip_scripts under XLDEPLOY_HOME/ext/ and put below 2 scripts file in it.
install-zip.sh with the following content:

#!/bin/sh
unzip ${deployed.file} -d ${deployed.targetPath}

uninstall-zip.sh with the following content:

#!/bin/sh
rm -rf ${deployed.targetPath}

You will need then to restart XLDeploy server in order to reflect this new type.

Then in your application from repository you can define the zip as being of type arch.Zip.

Cause

By default if you deployed zip file it will not be unzipped.

Additional Information

This Example was for Linux you can do the same for Windows by changing scripts syntax to match that.

Tags

XLDeploy, Extentions

Have more questions? Submit a request
Powered by Zendesk