3

我正在尝试为 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
4

2 回答 2

3

可能睡眠时间不够。

尝试wait改用。您可以指定是否可以获取它的 PID play auto-test,或者要求它等到所有后台进程结束。

看这里:http ://unstableme.blogspot.com/2008/06/bash-wait-command.html

于 2011-03-18T21:49:57.397 回答
0

也许你可以试试 Play 的 Jenkins 插件!框架。

请参见此处(我已解决的有关 Jenkins 和 Play 的问题!):CloudBees + PlayFramework + Eclipse

在这里:https ://wiki.jenkins-ci.org/display/JENKINS/play-plugin

于 2011-10-28T09:52:46.977 回答