playframework 自动测试 Jenkins CI 等待完成?

发布于 2024-10-24 12:21:34 字数 1027 浏览 1 评论 0原文

我正在尝试为 playframework.org 应用程序设置 Jenkins CI,但在运行自动测试命令后无法正确启动播放。

测试都运行良好,但似乎我的脚本同时启动了 play auto-testplay 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰雪梦之恋 2024-10-31 12:21:34

可能是睡眠时间不够。

尝试使用 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 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

停滞 2024-10-31 12:21:34

也许你可以尝试 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文