Tuesday, July 14, 2015

Continuous build on Message Flow with Jenkin 2

Not long ago, I’d done it once, but failed. That was happened on past 2 months ago. But now he is back again. Thanks to my colleague on his effort to discover this feature. This round ANT is used in the mission. First we try on this approach:
    < target name="create_bar">
     <mkdir dir="${dist.path}"/>
     <exec dir="." executable="C:/Program Files (x86)/IBM/WMBT800/mqsicreatebar.exe" failonerror="false" >
      <redirector output="error.log" alwayslog="true"/>     
      <arg line="-data . "/>
      <arg line="-b ProjectA/BARs/ProjectA.bar"/> 
      <arg line="-cleanBuild"/>
      <arg line="-l ProjectA"/> 
     </exec> 
    </target>
Pay attention on the argument –data and –b, the value might be different depends on the file structure. For my case, I put the build.xml inside the project folder. There is a con on this approach where it takes approximately 3 minutes to complete a build. Why does it take so long? The text below was extract from this document for easy reference.

3.2 Execution time It will be noted that when the BAR file is built from the command line, the time taken is often noticeably longer than time taken when built from the WMB ToolKit. This is because the mqsicreatebar command actually runs the Eclipse client itself in a 'headless' mode. The Eclipse front end probably keeps track of various file names, project references and lots of other parameters that speeds up the build time. As this does not happen from command line, the time taken is noticeably longer.
The second approach we did was this:
    < target name="package_bar">
     <mkdir dir="${dist.path}"/>
     <java classname="com.ibm.broker.config.appdev.FlowRendererBAR" failonerror="true" fork="true">
      <arg line="-a ${dist.path}/ProjectA.bar"/>
      <arg line="-w ../"/>
      <arg line="-y commonJava commonESQL ProjectA"/>
      <classpath>
       <fileset dir="C:/Program Files/IBM/MQSI/8.0.0.3/classes">
        <include name="*.jar"/>
       </fileset>
      </classpath>
     </java>
    </target>
With this approach, the execution time is damn fast. I’m feeling much better with this approach.

Reference resource

No comments: