开发者

playframework auto-test Jenkins CI wait for completion?

I am trying to set up Jenkins CI for a playframework.org application but am having trouble properly launching play after the auto-test command is run.

The tests all run fine, but it seems as though my script is launching both play auto-test and play start --%ci at the same time. When the play start --%ci command runs, it gets a pid and everything, but it's not running.

FILE: auto-test.sh, jenkins runs this with execute shell

#!/bin/bash
# pwd is jenkins workspace dir
# change into approot dir
cd customer-portal;

# kill any previous play launches
if [ -e "server.pid" ]
then
    kill `cat server.pid`;
    rm -rf server.pid;
fi

# drop and re-create the DB
mysql --user=USER --password=PASS --host=HOSTNAME < ../setupdb.sql

# auto-test the most recent build
/usr/local/lib/play/play auto-test;开发者_JAVA技巧

# this is inadequate for waiting for auto-test to complete?
# how to wait for actual process completion?
# sleep 60;
wait;

# Conditional start based on tests
# Launch normal on pass, test on fail
#
if [ -e "./test-result/result.passed" ]
then
    /usr/local/lib/play/play start --%ci;
    exit 0;
else
    /usr/local/lib/play/play test;
    exit 1;
fi


Maybe the sleep time is not enough.

Try using wait instead. You can specify the PID of play auto-test if you can get it, or ask it to wait until all background processes are over.

Look here: http://unstableme.blogspot.com/2008/06/bash-wait-command.html


Maybe you can try the Jenkins plugin for Play! Framework.

See here (my resolved issue concerning Jenkins and Play!) : CloudBees + PlayFramework + Eclipse

And here : https://wiki.jenkins-ci.org/display/JENKINS/play-plugin

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜