我正在尝试为 playframework.org 应用程序设置 Jenkins CI,但在运行自动测试命令后无法正确启动播放。
测试都运行良好,但似乎我的脚本同时play auto-test
启动play start --%ci
。当play start --%ci
命令运行时,它会得到一个 pid 和所有内容,但它没有运行。
文件:auto-test.sh,jenkins 使用执行 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;
# 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