Topic
  • 1 reply
  • Latest Post - ‏2013-01-14T06:01:13Z by IdanAdar
EricBatzdorff
EricBatzdorff
18 Posts

Pinned topic ANT task app-deployer and adapter-deployer, lessons learned

‏2013-01-09T16:56:06Z |
I found a few scenarios where app-deployer and adapter-deployer did not complete successfully. One was a scenario where the worklight server hangs. In this case, the deployer tasks will also hang thus hanging the build process.

Another scenario is where the deployer tasks log a SEVERE message. In this case, the task still succeeds from ANT's perspective. This may be okay for some, but I want the ANT process to fail in the case that the deploy task didn't do what it was supposed to do.

To address both of these, I've called the app-deployer task with the following ANT code. (adapter-deployer will look similar.) This addresses both my issues by 1) timing out the app-deployer call if there's a hang and 2) failing the build process in the event that the app-deployer task logs a SEVERE message.

<macrodef name="appWorklightDeploy">
<attribute name="appId" />
<sequential>
<property name="deploy.results.file" value="${temp.dir}/app.deploy.results.log"/>
<record name="${deploy.results.file}" loglevel="info" append="false"/>

<property name="local.worklight.app.id" value="@{appId}" />
<echo>Deploying application http://${local.worklight.app.id} to server http://${worklight.server.url.resolved}</echo>
<parallel threadCount="1" timeout="${worklight.deploy.timeout.ms}">
<sequential>
<app-deployer deployable="${target.dist.dir}/${local.worklight.app.id}-all.wlapp"
worklightServerHost="${worklight.server.url.resolved}"/>
</sequential>
</parallel>
<!-- validate no SERVER error in app-deployer -->
<loadresource property="app.deploy.results">
<file file="${deploy.results.file}"/>
</loadresource>
<condition property="app.deploy.severe.error">
<matches pattern="[app-deployer] SEVERE:" string="${app.deploy.results}"/>
</condition>
<fail message="App deploy failed. If the server is configured correctly, try deploying again or restarting the worklight server and then try deploying again. Error message: ${app.deploy.results}" if="app.deploy.severe.error"/>
</sequential>
</macrodef>
  • IdanAdar
    IdanAdar
    741 Posts

    Re: ANT task app-deployer and adapter-deployer, lessons learned

    ‏2013-01-14T06:01:13Z  
    Eric,
    Sorry for the late reply.

    1. The hanging scenario sounds like a defect. Can you though elaborate with steps to reproduce, or any logs you may have? This will help with opening a customer issue for this.

    2. Please submit a feature request for timing out the app-deployer in case it takes too long:
    http://www.ibm.com/developerworks/forums/thread.jspa?threadID=461545&tstart=0

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform