playframework 自动测试 Jenkins CI 等待完成?
我正在尝试为 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
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;
# 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能是睡眠时间不够。
尝试使用
wait
代替。如果可以的话,您可以指定play auto-test
的PID,或者要求它等待所有后台进程结束。看这里:http://unstableme.blogspot.com/2008/06/ bash-wait-command.html
Maybe the sleep time is not enough.
Try using
wait
instead. You can specify the PID ofplay 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
也许你可以尝试 Play 的 Jenkins 插件!框架。
请参阅此处(我已解决的有关 Jenkins 和 Play 的问题!):CloudBees + PlayFramework + Eclipse
这里:< a href="https://wiki.jenkins-ci.org/display/JENKINS/play-plugin" rel="nofollow noreferrer">https://wiki.jenkins-ci.org/display/JENKINS/play-plugin
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