Monday, July 27, 2015

Continuous build on Message Flow with Jenkin 3

Since the build was so successful on last time. My colleague, Ming Kuan, doesn't want to let Jenkins stops. He is pushing Jenkins to next level – deploy to Message Broker after the build. Not much information could be found on the Internet for this issue. But he was successfully implemented it on Jenkins. He is a ranger, warrior, a real fighter among the team member. What he did was he created a BATCH script for the deployment job and then this BATCH script was triggered from ANT script.

This is the ingredient for ANT, its job only to trigger BATCH:
< target name="deploy">
   <exec executable="cmd">
      <arg value="/c"/>
      <arg value="${deploy_file_path}/deploy.bat"/>
      <arg value="${bar_file}.bar"/>
   </exec>
</target>

This is the ingredient for BATCH:
call "C:/Program Files/IBM/MQSI/8.0.0.0/bin/mqsiprofile.cmd"

SET EXE_PATH="C:/Program Files/IBM/MQSI/8.0.0.0/classes/*;C:/Program Files (x86)/IBM/WebSphere MQ/java/lib/*"

SET PATH=%PATH%;C:/Program Files/IBM/MQSI/8.0.0.0/jre16/bin;C:/Program Files/IBM/MQSI/8.0.0.0;

SET BAR_FILE =%1

java -cp %EXE_PATH% com.ibm.broker.config.util.Deploy -i 192.168.1.8 -p 1818 -q Q1 -e E1 -a %BAR_FILE% -w 600

java -cp %EXE_PATH% com.ibm.broker.config.util.MessageFlowControl -stop -i 192.168.1.8 -p 1818 -q Q1 -e E1

java -cp %EXE_PATH% com.ibm.broker.config.util.MessageFlowControl -start -i 192.168.1.8 -p 1818 -q Q1 -e E1

*Alert! Notice there is a path, C:/Program Files/IBM/MQSI/, being pre-code in the BATCH. This path contains various raw materials to feed the deployment process. Thus, make sure WebSphere MQ was installed on the system. If it doesn’t, C:/Program Files/IBM/MQSI/ will never exist on the system.

The com.ibm.broker.config.util.Deploy is just like the regular mqsideploy command use in ours daily job for deployment purpose. And com.ibm.broker.config.util.MessageFlowControl is just like mqsistartmsgflow and mqsistopmsgflow use to restart the execution group. The reason for this is to make sure the deployment will take effect immediately after deployment.

Nice work from our warrior, Ming Kuan.

Keep on building, Jenkins!

No comments: