Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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
share|improve this question
1  
Seems to be more an issue with my lack of bash scripting skillz than anything else...looks like the build script isn't terminating and basically sitting and waiting like it was run in the foreground. I had Jenkins console output was showing a persistent log of a running app! No good... –  Brian Mar 18 '11 at 23:26
    
'play test' --> 'play test app-name --%test' instead so it runs in the background. –  Brian Mar 19 '11 at 0:04

2 Answers 2

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

share|improve this answer

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

share|improve this answer
    
Thanks, but I'm still seeing the same behavior with a wait; without params, not exactly sure how to get at the pid for auto-test but will try to work from ps aux grep magic. –  Brian Mar 18 '11 at 22:38
    
If you try wait ${!}, you don't need a PID. It will wait for all background processes to finish, so it should automatically wait for play auto-test –  Sagar Mar 19 '11 at 21:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.