我正在尝试为playframework.org应用程序设置Jenkins CI,但在运行自动测试命令后无法正常启动播放。
测试都运行良好,但似乎我的脚本同时启动了play auto-test
和play start --%ci
。当play start --%ci
命令运行时,它会获得一个pid和所有内容,但它没有运行。
#!/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;
# 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
答案 0 :(得分:3)
也许睡眠时间不够。
请尝试使用wait
。如果可以,则可以指定play auto-test
的PID,或者让它等到所有后台进程都结束。
请看这里:http://unstableme.blogspot.com/2008/06/bash-wait-command.html
答案 1 :(得分:0)
也许你可以尝试使用Jenkins插件进行播放!框架。
请参阅此处(我已解决的有关Jenkins和Play的问题!):CloudBees + PlayFramework + Eclipse