http://www.perlmonks.org?node_id=688690

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone recommend an alternative to CruiseControl? CC is a Java program that periodically runs a build (typically it runs Java compilation) and emails you if there's a problem.

The first thing that comes to mind is to just have a cron task that runs make on my Makefile. However, how can I programmatically detect if the build fails and jump to my send_email script?

As for an html interface to build results, it seems like it would be simple enough to write a CGI script to scan the build product director(y|ies)... though it would be nicer if it could show me a log from make telling me what happened.

Searching the CPAN, I found Test-AutoBuild. Anyone have any experience with this distribution? I didn't see anything on it at cpanratings.

  • Comment on Perlish alternative to CruiseControl (automated builds)?

Replies are listed 'Best First'.
Re: Perlish alternative to CruiseControl (automated builds)?
by jettero (Monsignor) on May 27, 2008 at 16:54 UTC
    The first thing that comes to mind is to just have a cron task that runs make on my Makefile. However, how can I programmatically detect if the build fails and jump to my send_email script?

    Dunno about yours, but my cron tends to email me every time something exits with a non-zero exit status. GNU Make would be among the programs that exits with meaningful status.

    Other than cron, I'd look at the new and exciting IPC::System::Simple, possibly combined with Net::SMTP::OneLiner. Suddenly it seems like a four line program to me.

    -Paul

      Ah, of course. make exits with its own non-zero status if one of the commands it runs exits with a non-zero status. And thus, cron would -- as expected -- send an email.

      So, it looks like all I'd need to do to get a web interface at that point would be: write a CGI script to check for new email and go from there.

      Thanks!

Re: Perlish alternative to CruiseControl (automated builds)?
by petdance (Parson) on May 27, 2008 at 22:38 UTC
Re: Perlish alternative to CruiseControl (automated builds)?
by dragonchild (Archbishop) on May 27, 2008 at 18:42 UTC
    Generally, you cron the script that does that sort of detection. So, if there's any decisions to be made, you have to write the script ot make that decision. cron just runs the thing.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

      Right, I think I see what you mean: cron the make command directly, and then right after that cron a script that checks if there's any new email.

      Thanks.

        Uh, no. Write a script that does everything (run make, check email, etc). Cron that.

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: Perlish alternative to CruiseControl (automated builds)?
by mhearse (Chaplain) on May 27, 2008 at 23:47 UTC
    #!/bin/bash #assume we call this program /bin/cruise_control error_file=/tmp/make.$$ cd /your/project/path make ${ARGS} 2> $error_file || { cat $error_file | /bin/mail -s "project build error" you@yout.com }
    Run from cron on a detached screen. Which means you can join the screen (screen -r cruise_control) if you ever want to watch the build process. Otherwise the screen exits when the build is finished.
    01 * * * Mon-Fri root /usr/bin/screen -mdS cruise_control /bin/cruise_ +control
Re: Perlish alternative to CruiseControl (automated builds)?
by jdporter (Paladin) on May 27, 2008 at 18:35 UTC

      That thread was about potential alternatives to make, written in Perl. This thread is about build automation, possibly using Perl to manage it.

Re: Perlish alternative to CruiseControl (automated builds)?
by Mutant (Priest) on May 28, 2008 at 09:26 UTC

    There's no reason why you can't use CruiseControl for Perl (or Hudson, which seems to be gaining popularity, or AnthillPro, which we're currently rolling out at work, which does a *lot* more than CI, but isn't free).

    These things tend to work by running executables, and parsing particular types of outputs, usually Maven or Ant for build in the Java world, and jUnit for tests. But they're pretty extensible, so you can use them with make and TAP with some minor scripting. There is Smolder, as has already been metioned, if you need it to be Perl.

      Not to be harsh, but, from my perspective, any XML-based build description language/tool is crippleware by design. The ant-contrib project rescued ant slightly, but the whole concept of incorporating control flow into XML I have judged, by experience, to be awful.
        You're talking about Ant / Maven? As I said, you don't have to use those. CI tools are a completely different beast. AnthillPro is configured via GUI (and backed by a RDBMS). AnthillPro is nothing to do with Ant.