Friday, May 29, 2015

Continuous build on Message Flow with Jenkin

Every time there is a new release, I am required to get the latest source from SVN, make the build and then deploy using WebSphere Message Broker Toolkit. This is so manual way. Then later something cool pops up in my mind: “Could it be better if I automate the process in Jenkins”? Since Jenkins do support Windows batch command and WebSphere Message Broker able to accomplished task through command line, thus both tools might integrate together. Here are the steps to mimic the whole process from start to end:
  1. Clean the workspace.
  2. Get latest source from SVN.
  3. Build the bar file.
  4. Deploy to server.
Let’s start coding on batch script.
del /s /q MessageFlowProject\*.*
    for /d %%x in (.\MessageFlowProject\*) do @rd /s /q "%%x"
    FOR /f "tokens=*" %%G IN ('DIR /b /ad /s MessageFlowProject\*.svn*') DO RMDIR /s /q "%%G"
    svn checkout --force SVN_URL module_A
    svn checkout --force SVN_URL module_B
    svn checkout --force SVN_URL module_C
    svn checkout –-force SVN_URL MessageFlowProject
    C:\"Program Files"\IBM\MQSI\\bin\mqsiprofile.cmd
    mqsipackagebar -a -w . -y module_A module_B module_C MessageFlowProject
    mqsideploy -i -p 1418 -q QueueA -e GRP.A -a -w 600
Notice the 3rd is required to clean .svn path as the 2nd statement unable to handle hidden path since .svn are hidden in file system. The script doesn’t work as expected in Jenkins environment. The build result was successful, and I could see following trace in the console output:
I notice the last 2 statements, which is mqsi*, doesn’t get invoke after mqsiprofile.cmd were executed. I think this is due to mqsiprofile.cmd has additional environment configure to the system where Jenkins not able to read from there.

I’m running out of clue how could I continue, I am stuck!

No comments: